Edit the markup of categories list

List of possibilities You got exactly two options to alter the output of wp_list_categories() Use a filter after the MarkUp was generated and re-format it: add_filter( ‘wp_list_categories’, ‘wpse88292_reformat_list_cats’, 10, 2 ); function wpse88292_reformat_list_cats( $output, $args ) { // Reformat `$output` here // You can use `$args` to only this when condition X == Y return … Read more

Force index.php have_posts() loop to exit if no sticky posts found

That is because get_option will return an empty array if there are no sticky posts and the query will default to everything. $sticky = get_option(‘sticky_posts’); if (!empty($sticky)) { $args[‘post__in’] = $sticky; $qry = new WP_Query(array(‘post__in’ => $sticky)); if ($qry->have_posts()) : while ($qry->have_posts()) : $qry->the_post(); echo $post->post_title; endwhile; endif; } And please don’t use query_posts.

Some doubts about how to show posts in a custom theme?

get_template_part() is including a template file from the active theme directory. For example: get_template_part(‘content’) will include the template content.php from the theme folder. When having two parameters, it will search for a template named firstParameter-secondParameter.php. So: get_template_part( ‘content’, get_post_format() ); will include the content-{$post_format}.php file. get_post_format() returns one of this defined formats: aside chat gallery … Read more

Retrieve all posts within tag OR category?

You need a tax_query. $live_tags = array( ‘posts_per_page’ => 5, // showposts has been deprecated for a long time ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘tax_query’ => array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => ‘live’, ), array( ‘taxonomy’ => ‘category’, ‘field’ => ‘slug’, ‘terms’ => ‘candy’, ), ), ‘orderby’ … Read more

wp_get_attachment_image_src() width and height boolean

This sounds like a description of the JetPack’s Photon service. Photon is an image acceleration and modification service for Jetpack-connected WordPress sites. Converted images are cached automatically and served from the WordPress.com CDN. Images can be cropped, resized, and filtered by using a simple API controlled by GET query arguments. When Photon is enabled in … Read more