Tag Info

New answers tagged

1

Use this. you will need to call thumbnail sizes. $small_regular = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), 'small_regular' ); $big_regular = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID), 'big_regular' ); echo "<style type='text/css'>"; echo ".entry-featured-image { background-image: url('" . ...


0

You can actually set and use custom thumbnails using this code in your functions.php, modified appropriately of course. add_image_size( 'a', 80, 80, true ); // Hard Crop add_image_size( 'b', 120, 120 ); // Soft Crop add_image_size( 'c', 590, 9999 ); // Unlimited Height Mode Details: Post Thumbnails on the Codex Also a good resource: WPBeginner


3

You are not using loop properly. Not tested but you can try this: <?php if (have_posts()) : ?> <br /> <div class="jumbotron"> <?php while (have_posts()) : the_post(); ?> <?php the_post_thumbnail(array('class' => 'img-thumbnail')); ?> <?php endwhile; ?> <br /><br ...


0

Have a look at http://codex.wordpress.org/Customizing_Feeds and try using a template for your feed. There are a variety of ways to customize your feeds, through the use of third-party software you install and add-on to your WordPress site, or by manually changing the feed templates to meet your needs. Find a tutorial here ...


0

Whenever I'm trying to link two sites, I find the most efficient and least destructive way is to use the WordPress XMLRPC API. http://codex.wordpress.org/XML-RPC_WordPress_API/Posts In this case, you could pull this info through using the built in IXR_Client library. This saves a ton of time writing code and trying to mix databases. If they wind up on ...


0

This is pseudo-code answer. First get the posts you want with get_posts (you can pass the post_type as an argument) Then get the ID of the images you want to set as thumnbail Now do a loop and try with a query similar to this one: "UPDATE wp_postmeta SET meta_value = $image_id WHERE post_id = $post_id AND meta_key = ''_thumbnail_id''" NOTE: To get the ...


0

You can try the following: /** * Get the featured image by post title (Simple version) * * @see http://wordpress.stackexchange.com/a/158344/26350 * @param string $title Post title * @param mixed $size Featured image size */ function get_featured_image_by_post_title_wpse_simple( $title = '', $size = 'thumbnail' ) { $obj = ...


0

Check the parameters for the_post_thumbnail Thumbnail Sizes the_post_thumbnail( array(100, 100) ); Or you can add a custom image size for featured images using add_image_size in your function file which includes the width and height add_image_size( 'postbox-thumb', 100, 100, TRUE );


3

How can we force has_post_thumbnails() to return false? Method #1 - disable theme support: You can remove the post thumbnails support from the backend, with function twentythirteen_child_setup() { remove_theme_support( 'post-thumbnails' ); } add_action( 'after_setup_theme', 'twentythirteen_child_setup', 11 ); but notice that this will not remove ...


0

I think that you're adding the code inside the loop of index.php or blog template file. You might be try this kind of things: if ( class_exists( 'MultiPostThumbnails' ) && ( MultiPostThumbnails::has_post_thumbnail( get_post_type(), 'header-image' , get_the_ID() ) ) ) { MultiPostThumbnails::the_post_thumbnail(get_post_type(), ...


1

Next time having a look at the docs might help ;) MultiPostThumbnails::has_post_thumbnail( $post_type, $id, $post_id = null ) Source: https://github.com/voceconnect/multi-post-thumbnails/wiki/Functions-and-Template-Tags#has_post_thumbnail I guess you can make it from here. If not let us know.


0

This is wrong <?php if ( have_posts() ) { while ( have_posts() ) { if ( has_post_thumbnail() ) { echo "<div id='post_thumbnail'>"; the_post_thumbnail(); echo '<h4>' . ...


0

That's because object properties are case sensitive, thus $post->ID is not the same as $post->id . Just by printing out these two you'll notice the difference, or do a print_r of the $post object to see all of the available properties and methods.



Top 50 recent answers are included