WordPress.org

Support

Support » Themes and Templates » How to extract Price and display it on featured image?

How to extract Price and display it on featured image?

  • On each post there is a price value (ex. Price: $99).
    How can I get that value and make it display on the featured image.

    I have a theme that uses loop.php Here is the code that is currently on it:

    <a id="post-<?php the_ID(); ?>" class="entry-box <?php if($post_count % 3 == 0) { echo 'entry-last'; } ?>" href="<?php the_permalink(); ?>">
    
    	<?php the_post_thumbnail('entry-thumb', array('class' => 'entry-thumb')); ?>
    
    	<div class="entry-comment">
    
    	</div><!-- .entry-comment -->
    
    	<h2 class="entry-title"><?php the_title(); ?></h2>
    
    	<?php if(get_option('table_entry_excerpt_enable') == 'on') { ?>
    		<div class="entry-excerpt">
    			<?php tj_content_limit('130'); ?>
    		</div><!-- .entry-excerpt -->
    	<?php } ?>
    
    </a><!-- #post-<?php the_ID(); ?> .entry-box -->

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi

    @esmi

    Forum Moderator

    First, identify what ecommerce plugin you are using and then post in that plugin’s dedicated forum via its page in the Plugin Repository.

    Thanks for reply Esmi.

    I forgot to add that this is not an ecommerce site. The prices are posted manually inside articles.

    esmi

    @esmi

    Forum Moderator

    I would suggest that you use custom fields for your prices rather than just dumping them into the Post/Page content.

    Thanks for the advice. However I can’t get it to work.. I am a newbie with all the php and I can’t get it to be displayed on the featured images.

    Isn’t there any function able to extract the numbers after the $ sign in a post?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to extract Price and display it on featured image?’ is closed to new replies.
Skip to toolbar