Hot answers tagged

3

You got it quite right, but with a few minor problems. First, please use a uniqe prefix for your functions and values - opacity or meta_save are quite generic and could be used by other authors. Second, the part where you get the meta opacity was missing, I added it for you - just retrieve the meta value from the current post. Third, I then created a ...


2

Life can be simple: Instead of the_post_thumbnail I should use get_the_post_thumbnail echo get_the_post_thumbnail($page->ID)


2

This is sort of an alternative solution to doing a bunch of RegEx. Query all images attached to the post, get the thumbnail of the first and display it as thumbnail ( you could even assign it as the post thumbnail if you wanted to, to make it easier next time the loop is run ). So inside your loop you would have: if( have_posts() ) { $image_mimes = ...


1

In your example, $posts_page contains the ID of the page for posts, you can use that with any API function that accepts a post ID. For the featured image: $posts_page = get_option( 'page_for_posts' ); $post_thumbnail_id = get_post_thumbnail_id( $posts_page ); $url = wp_get_attachment_image_src( $post_thumbnail_id, 'your-custom-size' ); echo $url; And ...


1

You can make use of the queried object. On the blog page, the queried object will hold the page object of the page set as blog page. The following will work (This is if you just need to show this on the blog page) /** * Use $post as local variable in order use setup_postdata * in order to make the use of template tags available */ if ( is_post_page() ...



Only top voted, non community-wiki answers of a minimum length are eligible