- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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…
Is it possible that no one have an idea? I posted this on stackoverflow, and I did not get answer there either.
Guys you can find solution here. Thank you :D