List custom post types in dropdown

Sorry about that feels a bit weird answering ones own question, but here you go…. Firstly declare the variable: (customcategory) global $userdata; $errors = array(); $title = trim($_POST[‘wpuf_post_title’]); $customcategory = trim($_POST[‘customcategory’]); $content = trim($_POST[‘wpuf_post_content’]); $tags = wpuf_clean_tags($_POST[‘wpuf_post_tags’]); $cat = trim($_POST[‘cat’]); Secondly the array for adding the post: if (!$errors) { $frontend_post = array( ‘post_title’ => … Read more

Drop down+sort blog posts date added/most popular

Yes, we can sort WordPress posts in different orders, You can do following sorts without installing plugins. sort post by date ( ascending / descending ) Sort post by title (ascending / descending ) Sort post by comment count ( ascending / descending ) — These are just basic we can do even more using … Read more

Filter results with custom field values and dropdown

Edited according to first comments and Pastebin code: <?php /* You can also leave ‘action’ blank: action=”” */ ?> <form method=”post” action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>”> <select name=”my_size” id=”size” class=”postform” onchange=”submit();”> <option selected=”selected”>Choose a size</option> <option value=”10″>10</option> <option value=”20″>20</option> </select> </form> <?php /* Reset filter */ ?> <p><a href=”https://wordpress.stackexchange.com/questions/83928/<?php the_permalink(); ?>”>Clear filter</a></p> <?php if( !isset($_POST[‘my_size’]) || … Read more

How to store the value of a custom field dropdown select for post referencing?

selected() was big help for setting a default value. The rest I found in this brilliant meta box tutorial: http://code.tutsplus.com/tutorials/how-to-create-custom-wordpress-writemeta-boxes–wp-20336 with examples for text input, checkboxes and dropdown. Also Custom post type’s slug gets wrong when adding a custom meta box explained me how to correctly handle the current post object so it doesn’t get … Read more

Block Editor: add an aria-label to an option inside a SelectControl

I agree with Nathan’s answer, but you can copy the source and create your own SelectControl component based on that source. Here’s an example, with basically just the aria-label addition: <option key={ `${ option.label }-${ option.value }-${ index }` } value={ option.value } disabled={ option.disabled } aria-label={ option.ariaLabel || ” } > { option.label } … Read more

Bootstrap drop down menu with wp_nav_menu

You will need to write a custom walker extending Walker_Nav_Menu, more or less like so: class My_Custom_Nav_Walker extends Walker_Nav_Menu { function start_lvl(&$output, $depth = 0, $args = array()) { $output .= “\n<ul class=\”dropdown-menu\”>\n”; } function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $item_html=””; parent::start_el($item_html, $item, $depth, $args); if ( $item->is_dropdown … Read more

Show child pages by menu order using Superfish Dropdown menu?

I downloaded this plugin and took a look and it does work as advertised for me. The function it uses for displaying the page list is: wp_list_pages(array( ‘sort_column’=>’menu_order’, ‘depth’=>’4’, ‘title_li’=>”, ‘exclude’=>$exclude )); ?> Which is very straightforward and does very explicitly order the items via menu_order. However, because it’s a core function subject to actions … Read more

Dropdown with category selection

Here is a variation of the code that you use. I’m using get_categories() here to achieve the same goal. I had to adjust my code slightly to make it acceptable for your need. There are a however other modifications you have to make for this to work. When you select the All Categories option, you … Read more

Bootstrap dropdown nav pills not working with wp_nav_menu()

I ran into similar problem when I created a bootstrap navigation menu and dropdown links were all showing up at once. I used the following steps to correct the issue: download navwalker from github repo link: https://github.com/wp-bootstrap/wp-bootstrap-navwalker put this file in the root folder of the theme and in the functions.php file userequire_once get_template_directory() . … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)