custom browse by

In your tag code you are missing a few quotes chars, the $tag var, and you cant endforeach like that i add braces for it: <div class=”tag-cloud” style=”margin: 20px 0;”> <?php echo ‘<select class=”tags”>’; // Add custom option as default echo ‘<option>’ . __(‘Select Tag’, ‘text-domain’) . ‘</option>’; // Get categories as array $tags = …

Read more

PHP drop down menu for my get_category child of

You can use the function wp_dropdown_categories() instead of wp_list_categories(), if you dont need to use the list function. wp_dropdown_categories() seems to be working just like the list function. So first just try and replace these two functions. $terms = wp_dropdown_categories( array( … Read about it in the codex here.

How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?

Here’s an easy way to generate a dropdown menu from your blog pages using the WordPress wp_dropdown_pages() function. Adding a bit of javascript you can send the user to the page when they select it <section id=”pageselect”> <span> <?php wp_dropdown_pages(‘show_option_none=Explore…’); ?> </span> <script type=”text/javascript”><!– var selectmenu = document.getElementById(“page_id”); function onPageChange() { if ( selectmenu.options[selectmenu.selectedIndex].value > …

Read more

Changing an item in drop down after 5 latest posts per taxonomy

Have a closer look to the blow code- $query_args = array( ‘posts_per_page’ => ‘5’, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ); $listedPosts = new WP_Query($query_args); // the loop if ( $listedPosts->have_posts() ) { while ( $listedPosts->have_posts() ) { $listedPosts->the_post(); if ( (int) $listedPosts->current_post == 5 ) { // You need to use ‘==’ or ‘===’ …

Read more

How can I create this menu with wp_nav_menu()?

This can achieve with a nav walker. I used this. I am stepping according to the mentioned. Put navwalker (wp-bootstrap-navwalker.php) in your theme root Call to the navwalker in functions.php file. require_once(‘wp-bootstrap-navwalker.php’); Create your menu in WordPress Backend (Appearance -> Menus) In your menu area, according to me in header.php wp_nav_menu( array( ‘menu’ => ‘main_menu’, …

Read more

Multiple level category drop-down three levels is not working

Already was resolve my problem and the cause is because the component was created dinamically, the solution is use .on(“change”, instead .change(function(). I share the code of Ján Bočínec with the modification to use three dropdownlist or more. //Parent child con ajax function parent_child_cat_select() { ?> <script type=”text/javascript”> /* <![CDATA[ */ jQuery(document).ready(function() { //segundo drop …

Read more

Get Link of Page Selected through a Select Field in Custom Admin Page

First, you register your setting like this: function my_awesome_register_fields_for_additional_settings(){ register_setting(‘reading’, ‘my_awesome_pagelink_for_frontend_button’); add_settings_field(‘my_awesome_pagelink_for_frontend_button’, ‘<label for=”my_awesome_pagelink_for_frontend_button”>The Frontend Button shall link to this page:</label>’ , ‘my_awesome_pagelink_for_frontend_button_html’, ‘reading’); } add_filter(‘admin_init’, ‘my_awesome_register_fields_for_additional_settings’); After that, you define the callback for your settings field: function my_awesome_pagelink_for_frontend_button_html(){ $option = (int)get_option(‘my_awesome_pagelink_for_frontend_button’,0); wp_dropdown_pages(array( ‘selected’ => $option, ‘name’ => ‘my_awesome_pagelink_for_frontend_button’, ‘show_option_none’ => ‘Please Choose’, ‘option_none_value’ => …

Read more