Custom loop page with post navigation

I ended up creating two loops and utilizing anchors. I’m not sure if it’s the most efficient way of doing things, however, it works. add_action( ‘genesis_post_content’, ‘child_do_content’ ); // Adds your custom page code/content function child_do_content() {?> <ul class=”multicol”> <?php $custom_query = new WP_Query(array(‘orderby’ => ‘title’, ‘order’ => ‘ASC’,’cat=5′)); while($custom_query->have_posts()) : $custom_query->the_post();?> <li><a href=”#<?php the_title(); … Read more

Custom Meta Box If Else Statement

You can try this: <?php // get image source: $metaboxtext3 = esc_attr( get_post_meta( get_the_ID(), ‘my_meta_box_text3’, true ) ); // get link: $metaboxtext4 = esc_attr( get_post_meta( get_the_ID(), ‘my_meta_box_text4’, true ) ); // check if the image source exists: if(strlen($metaboxtext3)>0){ ?> <a href=”https://wordpress.stackexchange.com/questions/84788/<?php echo $metaboxtext4; ?>”><img src=”<?php echo $metaboxtext3; ?>” alt=”” onerror=”this.style.display=’none'”/></a> <?php } ?>

single.php fires more than once after clicking on any post to view with different post id each time

I am answering this because nobody yet answered this and I think this could help others who are experiencing this kind of issue. As mentioned by s_ha_dum that the issue is related to FireFox’s Prefetching mechanism. In order to resolve this I inserted the below line to function.php: remove_action(‘wp_head’, ‘adjacent_posts_rel_link_wp_head’);

Loop through multiple custom taxonomy terms and display posts for a custom post type

If you look at your var_dump, near the end, you will see the actual query being used. SELECT wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id IN (93) ) AND wp_posts.post_type IN (‘post’, ‘page’, ‘attachment’) AND (wp_posts.post_status=”publish” OR wp_posts.post_author = 1 AND wp_posts.post_status=”private”) GROUP BY wp_posts.ID ORDER BY … Read more

Trying to display ads on only a third of posts in a loop. Keep getting Error 500?

echo “<img src=\”” . bloginfo(‘template_url’); . “/img/sample-ad-side.png\” alt=\”Sample Advertisement\”>”; You added a semicolon, what comes after that semicolon is a new statement. . “img/ etc is not valid PHP, so it errors out. Also bloginfo does not return its value, it prints it, so you need to change that to get_bloginfo. I would suggest you … Read more

Remove the_content From Loop

I don’t see anything that would cause the_content() to display in your code. Chances are, the template file you are editing is NOT the one being used on the page/archive you are checking. Add this to the top of your template files… <!– Template: <?php echo __file__; ?> –> Now, in your web browser view … Read more

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