Tag Info

New answers tagged

0

Building on @jorghe's answer, you still need to get the the 'term_id'. This works but seems less than ideal: <?php $images = get_option('taxonomy_image_plugin'); $terms = get_the_terms($post->ID, 'byline'); foreach ( $terms as $term ) { $img_url = wp_get_attachment_url( $images[$term->term_id] ); print $img_url; } ...


-2

Post thumbnails in WP are stored as meta-data. In /wp-includes/post-thumbnail-template.php, WP retrieves the post thumbnail ID by using the _thumbnail_id value, which can be used as a filter in your WP_Query. When used in this way, WP will check the retrieved posts to see if that meta_key value exists, and if so, it will include those posts in the query, ...


0

You can try this way : set_post_thumbnail( $my_post_id, $thumbnail_id ); You have to add image into library first like this way : $uploaddir = wp_upload_dir(); $file = $_FILES[ ... whatever you have in your POST data ... ]; $uploadfile = $uploaddir['path'] . '/' . basename( $file ); move_uploaded_file( $file , $uploadfile ); $filename = basename( ...


0

As brasofilo mentioned you can do a str_replace() on the admin_post_thumbnail_html filter. function changeFeaturedImageLinks($content) { $content = str_replace(__('Set featured image'), __('YOUR_CUSTOM_TEXT'), $content); $content = str_replace(__('Remove featured image'), __('YOUR_CUSTOM_TEXT'), $content); return $content; } ...


0

Would need to see the unmodified code from your themes content.php file to provide a tested solution which works on your specific theme. Here's a solution i tested on a child theme of Twenty Twelve. <?php function wpsites_post_thumbnail() { if ( in_category('category-first') ) : ?> <a class="post-thumbnail" href="<?php ...


0

Like @jdm2112, I'm not a Gensis user, but here is an alternative method to retrieving the featured image. I use this method because it offers more functionality to altering the featured image (ie: thumbnail size). You can add these functions to your functions.php file. public function get_featured_image_id() { return (int) $this->get_meta( ...


0

Displaying the featured image (referred to as 'thumbnail' in WP funcations) should not require you to replace your page loop. I'm not a Genesis user so there's a chance that is the case. Displayin the feature image for the page is as simple as using the WP function the_post_thumbnail . Here is WP ref for full details. Simply using this where you want the ...


0

I checked it out furthur and there were a couple of problems with your code. your if statement checks for a post ID, but you don't have a check for whether or not there is actually a featured image set, so I added a condition to the if statement your closing bracket for get_post_thumbnail_id() was misplaced you were not actually echoing $thumb_url ...


1

You need to escape the quotes in your echo statements: echo "<img src=""; should be changed to: echo "<img src=\""; or you could use single quotes so that you don't have to escape the double-quotes: echo '<img src="'; Similarly, your last line of code should be changed to: echo "\">";


0

Make sure to define( 'WP_DEBUG', FALSE ); in wp-config.php. For some reason it doesn't allow you to add featured images from a custom post type with Debugging on.


1

The most common way to achieve those features is to implement some sort of interface, usually in JSON or XML. To do this, you either use a plugin (http://wordpress.org/plugins/json-rest-api/ <= Will probably part of core in WP 4.0) or do the AJAX function yourself. An example would be: add_action( 'wp_ajax_get_thumbnail', 'ajax_get_thumbnail' ); ...



Top 50 recent answers are included