Add Image Before Posts Entry Title

This works fine for me when i test it. I did edit your code as you had a small error in the function name not matching. Also, you might want to add a conditional tag and wrap the shortcode in a div but otherwise it works. function adt_abovetitle($title){ //Return new title if called inside loop … Read more

Can’t get the_content to show

You never start the main loop: <?php if (have_posts()) : ?> <h1 class=”pricing”>Prices</h1> <h2><?php the_title(); ?></h2> <?php the_content(); ?> You check if there are posts in the main query, but you never start the loop, and jump straight to showing the title and content, you need to move everything into a main post loop. Without … Read more

get_post_fields as an excerpt

Give this a try. Basically, your get_posts looks OK, but you need to setup the post information. This leats you use the normal functions the_something and get_something without having to pass in a post object / ID each time. Just remember to call wp_reset_postdata(); anytime you use setup_postdata(). <?php $random_post = get_posts(array( ‘category’ => ‘objects’, … Read more

Put teaser content, more-link and full content in different divs if existing… Possible?

Found a solution which is working. Splitting the array like above just gives you the plain text so shortcodes wont work. this works: global $post; $content = get_extended( $post->post_content ); //get the_content $excerpt = $content[‘main’]; //get the teaser part before more tag $main_content = apply_filters(‘the_content’, $content[‘extended’]); //get part after more tag echo $excerpt; //post teaser … Read more

Echo Most Recent Sticky Post in Loop?

If it’s your main loop, you could add this to your function.php: function custom_pre_get_posts($query) { if($query->is_main_query() && /* is sticky conditional tag(sorry I need to check what is that) */) { $query->set(‘posts_per_page’, “1”); } } add_action(‘pre_get_posts’, ‘custom_pre_get_posts’); Or you can make a new WP_Query instance in the theme file: <?php $onePost = new WP_Query(array( ‘post_type’ … Read more

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