page url in shortcode

Depending on how the page’s query and loop are constructed, when you access the post object from the sidebar or footer, you sometimes get the last post in the loop rather than the page itself. You can ensure you’re getting the original (page) object by running wp_reset_query() from inside your widget (before you access the … Read more

Thumbnail images

Inside your post loop you can do; if ( has_post_thumbnail()) { echo get_the_post_thumbnail($post->ID, ‘thumbnail’); } This first checks for the existence of a featured image and if so it will display one at your default ‘thumbnail’ size as set in your settings/media options. This would also work within your loop; if ( has_post_thumbnail()) { the_post_thumbnail(‘thumbnail’); … Read more