Custom built theme won’t filter categories

The variable $theTitle is not interpolated in a single quote string. query_posts(‘category_name=.$theTitle&orderby=rand’); Will ask for exactly that string. $theTitle will not be replaced with a title and the dot (.) will remain in the query. The result will be unpredictable. So, use a double quoted string: query_posts( “category_name={$theTitle}&orderby=rand” ); Or change the order of the … Read more

How to show tags in posts with a theme that does not do it

Filter the_content, and add the result of get_the_tag_list(): add_filter( ‘the_content’, function( $content ) { if ( is_single() ) $content .= get_the_tag_list( ‘<p>Tags: ‘, ‘, ‘, ‘</p>’ ); return $content; }); The other option is to create a child theme and add the_tags() where you need it in a template.

Categorising themes by folders in backend

Updated plugin version available at GitHub. I first saw your Question at [wp-hackers] list, and, after implementing the solution, was about to publish a Q&A for that. Well, it’s already here, and has a bounty put on it 🙂 As Daniel Bachhuber points out in the thread: WordPress.com puts themes inside of subdirectories /wp-content/themes/public /wp-content/themes/premium … Read more

div having different appearances in different themes

You need to be specific when defining your CSS styles so that a theme will not overwrite your intended style. When outputting your markup, perhaps you should even consider wrapping your div element within another div element and assuming this is the only markup on the page, you can specify them both with an #ID … Read more

How get the 10 most viewed pages (not post)

If you want to query pages you have to choose post_type=page – of course. Another “problem” is that the commen count isn’t exactly representing post/page views. If you really want page views – not comment count – try something like the function below – I got that from here: http://wpsnipp.com/index.php/functions-php/track-post-views-without-a-plugin-using-post-meta/. function getPostViews($postID){ $count_key = ‘post_views_count’; … Read more

Create custom post order (with custom post type meta)

Save your data in a single field as either YYYY-MM-DD or UNIXTIME. Then query like this: $args = array( ‘post_type’ => ‘POST_TYPE_NAME’, ‘meta_key’ => ‘date-key-name’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ); $query = new WP_Query( $args ); You should get an order, unless I am having a bad morning, of Day -> Month -> … Read more

Theme automatically inserting “more” tag on every post

In your archive.php file, you would want to replace this: <div class=”entry-content”> <?php colabs_custom_excerpt(); ?> <p class=”more”> <a href=”https://wordpress.stackexchange.com/questions/105195/<?php the_permalink() ?>”> <?php _e(“More”,”colabsthemes”); ?> </a> </p> With this <div class=”entry-content”> <?php the_excerpt(); // or the_content(); ?> </div><!– .entry-content –> The theme creator is MANUALLY inserting the more button (as you can see). You could just … Read more