How to get the title of root li element

In a nutshell, assuming you are using a walker to construct your menu. E.g. when customizing the start_el() method, the $item should be an object – somewhat – like the $post object. In reverse that means, you have access to post_parent property. With that information you can retrieve the title with get_the_title() easily. After your … Read more

add links to list of post terms

Then try to add foreach ( $arr_terms as $terms_links ) { if(!empty($terms_links)) { echo ‘<a href=”#”>’ . $terms_links . ‘</a>’;  } } That checks if the $terms_links is empty, and if so it wont print it out.

Add specific class to featured posts

I hope that “featured” will be a custom field of posts. In that case you can check the value of field using: $desc = get_post_meta($post->ID, ‘featured’, true); You can use if-else condition and check that if you get value=1 {or what you assigned for featured} then apply class”hot”. Give it a try. best of luck

Listing Custom Post Post from certain category

This can be achieved with Multiple Taxonomy Handling. Try this code. <?php $args = array( ‘post_type’ => ‘note’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘category’, ‘terms’ => array( ‘class 11’, ‘chemistry’ ), // Add suitable term slugs here ‘field’ => ‘slug’ ) ) ); $my_query = new WP_Query( $args ); if( $my_query->have_posts() ) { while … Read more

How Can Hide Define Category in Post Contents?

First add get_the_categories filter before the_category(‘ , ‘) then remove it. So it will not effect categories on other places. add_filter( ‘get_the_categories’, ‘remove_selected_categories’ ); the_category(‘ , ‘); remove_filter( ‘get_the_categories’, ‘remove_selected_categories’ ); In callback function check for categories to remove then remove them! function remove_selected_categories( $categories ) { $categories_to_remove = array( ‘years’, ‘genere’ ); //Place the … Read more

How to create page that lists tags by initial letter?

First Question’s Answer: For filtering based on your terms first letter you need to filter the query, which you can do with the terms_clauses hook. By putting the below code block in your theme’s functions.php you can do that- function the_dramatist_filter_term_clauses( $clauses ) { remove_filter(‘term_clauses’,’the_dramatist_filter_term_clauses’); $pattern = ‘|(name LIKE )\’%(.+%)\’|’; $clauses[‘where’] = preg_replace($pattern,’$1 \’$2\”,$clauses[‘where’]); return … Read more

How correct list-style displayed in firefox? [closed]

Replace “disk” with “disc” Here is some background: It has been reported, and they don’t want to fix it: https://bugzilla.mozilla.org/show_bug.cgi?id=1027647 based on a misinterpretation of: http://dev.w3.org/csswg/css-counter-styles-3/#extending-css2 Source

Drop down list code for sidebar

Well, in a “layman’s” terms, you need to add your preferred filter (specific category id and order) to the $args array, like so: $args = array( ‘numberposts’ => ‘5’, ‘post_status’ => ‘publish’, ‘cat’ => 5, ‘order’ => ‘ASC’, ‘orderby’ => ‘title’ ); The ‘cat’ should be the id of the “specific” category you want to … Read more

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