WordPress.org

Ready to get started?Download WordPress

Forums

How to extract Price and display it on featured image? (5 posts)

  1. VandyStan
    Member
    Posted 1 year ago #

    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 -->
  2. esmi
    Forum Moderator
    Posted 1 year ago #

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

  3. VandyStan
    Member
    Posted 1 year ago #

    Thanks for reply Esmi.

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

  4. esmi
    Forum Moderator
    Posted 1 year ago #

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

  5. VandyStan
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic