Question About Messing With Category Pages and Descriptions

Wrap it up! Err, in a conditional statement that is. if ( is_category( ‘My Category’ ) ) { echo ‘<p>’ . category_description() . ‘</p>’; } That is just a crude example, though. We would need to see your code to give a definitive answer. Reference: https://developer.wordpress.org/reference/functions/is_category/

Category names dependent on each other?

If you look at the twentyfifteen theme (and the other bundled themes) you’ll find code similar to the following: (this is taken from the twenty fifteen theme from inc/template-tags.php) $categories_list = get_the_category_list( _x( ‘, ‘, ‘Used between list items, there is a space after the comma.’, ‘twentyfifteen’ ) ); if ( $categories_list && twentyfifteen_categorized_blog() ) … Read more

How to display only sticky posts on category pages?

You can try to fetch the sticky posts IDs from the sticky_posts option and then modify the main query on the category archives accordingly: /** * Category Archives: Only display sticky posts for each category term */ add_action( ‘pre_get_posts’, function( \WP_Query $q ) { if( ! is_admin() && $q->is_category() && $q->is_main_query() ) { $sticky_posts = … Read more

Getting a sub category based on a category name

If you want to get all the descendents for the volume category and its ID is lets say 5: $categories = get_categories( array( ‘child_of’ => 5 )); foreach($categories as $category) { echo ‘<p>Category: <a href=”‘ . get_category_link( $category->term_id ) . ‘” title=”‘ . sprintf( __( “View all posts in %s” ), $category->name ) . ‘” … Read more

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