Why is the `if else` not working?

Assuming you’re using the function is_category_or_sub() as given on http://valendesigns.com/wordpress/is-category-or-subcategory-wp-function/ That function takes category id as the argument, not the slug. The string “gamenews” here when type-casted to an integer becomes 0 which is an ancestor for every other category. Can you try changing the function code to this- // If is category or subcategory … Read more

multiple queries to get posts from same category?

Just add a counter to the loop. Just use $wp_query->current_post while ( have_posts() ) : the_post(); if($wp_query->current_post <= 1) // 1 because counter starts at 0 // <div>first 2 posts go here</div> if($wp_query->current_post > 1 <= 3) // <div>second 2 posts go here</div> if($wp_query->current_post > 3 <= 5) // <div>last 2 posts go here</div> endwhile;

How can I get the featured image or the first image for a post/page and display it as a banner?

You can use the featured image (or featured thumbnail) for this type of functionality. You can control which size of the image you use… it doesn’t have to be the “thumbnail” size. From the codex: get_the_post_thumbnail(get_the_ID(), ‘thumbnail’); // Thumbnail get_the_post_thumbnail(get_the_ID(), ‘medium’); // Medium resolution get_the_post_thumbnail(get_the_ID(), ‘large’); // Large resolution get_the_post_thumbnail(get_the_ID(), ‘full’); // Original resolution get_the_post_thumbnail(get_the_ID(), … Read more

How to add an admin alert for missing plugins

To check if a plugin is installed and activated, use the is_plugin_active() function. Note that you need to include this function first on the front-end before you can use it: include_once ABSPATH.’wp-admin/includes/plugin.php’; Avoid function_exists() for doing the check. Plugins may refactor their code and a previously existing function might disappear. You never know.

Get video from the post on homepage

Couple of assumptions before getting to solution. First, you have all embedded codes as iframe (almost all video sites export as iframe now) not as shortcode or object tag. Secondly, you want the video box not the video url which will be offcourse different for every video website. Put following code in functions.php function the_post_video($post_id=NULL) … Read more