Can't echo $post
-
Hi,
I love this plugin first of all, It’s been a long time since I’ve last used it (I used it when it was just a git repo). I’ve decided to give the plugin a try but I can’t seem to get $post->ID.
My Code is:
<div class="news-grid-item grid"> <figure class="grid-content effect-layla"> <div class="img" style="background-image:url(<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID) );?>)" alt="thumbnail"></div> <figcaption> <h2>$post->ID<?php echo wp_trim_words(get_the_title($post->ID), 6); ?></h2> <p>Full Article</p> <a href="#" data-id="<?php echo $post->ID;?>" data-type="news" class="ajax-get-post" onclick="loadPost(<?php echo $post->ID ?>,'news')"></a> </figcaption> </figure> </div>
this line here get’s the attachment url but if I just try to echo the id I can’t get it.
wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
Any suggestions?
Cheers,
Brook.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Can't echo $post’ is closed to new replies.