Creating a “glossary” of WordPress posts of a specific post type

Declare a $previous_letter variable, and at the end of the foreach give it the value of the current $glossary_letter. Before of show the $glossary_letter make an if condition. If $glossary_letter is different to the $previous_letter then show it. $previous_letter = null; foreach ( $postslist as $post ) : setup_postdata( $post ); $glossary_title = get_post_custom_values($key = … Read more

Asynchronous request in wordpress

Your AJAX URL varaible is different in your PHP and your JS. In your JS you refer to ajax_url: url: modallist.ajax_url, But the variable defined in PHP is ajaxurl: ‘ajaxurl’ => admin_url(‘admin-ajax.php’) , This is why you’re getting the full admin page as a response. Your request is going to the current page because there … Read more

How to display different submenus?

It is ok to put other elements as child elements. I don’t see any problem with this. To add custom elements you have to add custom metabox to menu administration. WordPress will handle saving your custom elements automatically so you don’t need to worry about this. To display your custom elements you can create custom … Read more

WP_Query multiple post results

Your loop is wrong, you should not use to foreach inside the while, simply add the classic the_post () using the variable of your loop in this case $ loop for example <?php $args = array( ‘post_type’ => ‘product’, ‘stock’ => 1, ‘posts_per_page’ => 9, ‘product_cat’ => $pagename, ); $loop = new WP_Query( $args ); … Read more

How to translate wordpress error message

I was able to solve my problem, follow the code in case someone needs the solution: add_filter(‘login_errors’,’login_error_message’); function login_error_message($error){ //check if that’s the error you are looking for $pos = strpos($error, ‘incorrect’); if (is_int($pos)) { //its the right error so you can overwrite it $error = “Um ou mais campo estão em branco ou dados … Read more