Can’t print out returned value

Correct way to get the ratings for individual authors. This is for the author.php page. If you want to display it elsewhere on your site, for example to show the number of likes for the currently logged in user, then use get_current_user_id( ‘ID’ ); in place of get_the_author_meta. <?php function author_rating_total() { $user_id = get_the_author_meta( … Read more

how to use custom loop in the_content filter

the_content is expecting a string, you’ll have to use output buffering: function my_custom_loop() { $taxonomy = ‘state_cat’; $terms = get_the_terms($post->ID, $taxonomy); if ($terms && ! is_wp_error($terms)) : $terms_array = array(); foreach ($terms as $term) { $terms_array[] = $term->slug; } $have_you_read_query = new WP_Query( array( ‘posts_per_page’ => 100, ‘post_type’ => ‘post’, ‘post__not_in’ => array($post->ID), ‘category__not_in’ => … Read more

Insert/sticky multiple posts in multiple positions

You can try rebuilding an array of the two queries or splice the fixed_posts into the essays array. Maybe something like below. $essay = get_posts(); $fixed_posts = get_posts(); $post_positions = array(2,5,10); $x = 0; foreach ($essays as $i => $essay) { if ($post_positions[$x] == $i) { $top_posts[] = $fixed_posts[$x]; $x++; } $top_posts[] = $essay; } … Read more

Adding pagination to WP_Query [duplicate]

Give something like this a whirl: <?php // Get header get_header(); ?> <?php // Begin loop $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args = array ( ‘posts_per_page’ => 1, ‘paged’ => $paged ); query_posts($args); if (have_posts()) : while (have_posts()) : the_post(); ?> <article> <h1><?php the_title(); ?></h1> <p class=”time”><?php the_time(‘l, F jS, Y’); ?></p> <?php … Read more

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