Static pages not working
It’s more like: <?php if ( have_posts() &! is_front_page() ) : ?> this line should be: <?php if ( have_posts() && !is_front_page() ) : ?>
It’s more like: <?php if ( have_posts() &! is_front_page() ) : ?> this line should be: <?php if ( have_posts() && !is_front_page() ) : ?>
If you take a look at Template Hierarchy category-news.php would be archive template, that is for a list of multiple posts having specific category. There is no such thing as template for individual post, having specific category, in native template hierarchy. There are different ways to handle such, depending on your needs. Typical are: styling … Read more
You can create an easy to use function to do that for you. Like so: <?php function sg_user_posts_by_type($userid, $post_status) { $args = array( ‘numberposts’ => -1, ‘post_status’ => array($post_status), ‘author’ => $userid ); $count_posts = count(get_posts($args)); return $count_posts; } if (is_user_logged_in()) { // GET CURRENT USER DATA $user_id = get_current_user_id(); $user_data = get_userdata($user_id); $publish_count = … Read more
If i am not wrong then i think you are talking about this Blankslate theme. If this is the case then you can edit the older and newer links displayed on archive page by editing the following code by overwriting the theme file nav-below.php in the child theme. <div class=”nav-previous”><?php next_posts_link(sprintf( __( ‘%s older’, ‘blankslate’ … Read more
You can run a query using get_posts to retrieve posts from a specific author, and exclude certain categories, and then use count to return the amount of posts. get_posts uses the same parameters as WP_Query, so you can have a look at the parameters there <?php $args = array( ‘author’ => 1 //ID of the … Read more
Never use query_posts, use pre_get_posts to modify any main query. function wpd_exclude_author_category( $query ) { if ( $query->is_author() && $query->is_main_query() ) { $query->set( ‘category__not_in’, array( 42 ) ); } } add_action( ‘pre_get_posts’, ‘wpd_exclude_author_category’ );
The error message basically says that $wpdb is not an object so you can’t call any methods on it. As we can’t see where $wpdb is defined in the source you posted it’s hard to tell any further details. Are you even including wordpress in your external file? You need to require wp-load.php to use … Read more
Something along the lines of: $args = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘post’, ‘meta_key’ => ‘METAkeyNAME’, //what I assume you’ve called a meta box ‘meta_value’ => ‘THEdesiredVALUE’, ‘orderby’ => ‘ID’, //choose to order by anything look here [http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters] for more info ‘order’ => ‘ASC’, ); $results = new WP_Query($args); // ‘<pre>’.print_r($results).'</pre>’; // This is … Read more
I do not know this theme. But you must use this two functions somewhere: get_theme_mod (‘background_image’, $default); set_theme_mod (‘background_image’, $_category_image_absolute_path); Maybe, you can define new modification names with this functions. For example, ‘backgroud_image_entertainment’, ‘background_image_storysode’, etc. (as is shown in the referred web page) by using set_theme_mod. set_theme_mod (‘backround_image_entertainment’, $_category_image_absolute_path); Then, you should add some functions … Read more
rearrange your code and use post_count; example: <?php $movieNumber = 1; $today = date(‘Ymd’); $posts = array ( ‘post_type’ => ‘movie’, ‘posts_per_page’ => -1, ); $loop = new WP_Query( $posts ); ?> <div id=”posters<?php echo $loop->post_count; ?>”> <?php while ( $loop->have_posts() ) : $loop->the_post(); …etc…