Forums

Give help. Get help.

  • # December 8, 2017 at 12:36 am

    I have made simple front end post creator in wordpress, via form. On the end of post user is prompted to select the category, and based on users selection, the number of posts of this very category should be passed to input and incremented by 1. (I am trying to make some kind of numeration, lake page number, or something, because it is more than important to my customer to have this.).

    <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 
    <option value=""><?php echo esc_attr(__('Select Category')); ?></option> 
    
    <?php 
        $option = '<option value="' . get_option('home') . '/category/">All Categories</option>'; // change category to your custom page slug
        $categories = get_categories(); 
        foreach ($categories as $category) {
            $option .= '<option value="'.get_option('home').'/category/'.$category->slug.'">';
            $option .= $category->cat_name;
            $option .= ' ('.$category->category_count.')';
            $option .= '</option>';
        }
        echo $option;
    ?>
    

    So basically from this I have to pass the number of posts to simple and increment it by one.

    I have tried to use jQuery to read the select and than choose only number and pass it, but it did not work…

    # December 8, 2017 at 7:34 am

    Is it possible that no one have an idea? I posted this on stackoverflow, and I did not get answer there either.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag