• I’ve got a Read More link in my excerpts but i want it to display a price instead using this bit of code.

    <?php global $product; ?>
    <li>Only <?php echo $product->get_price_html(); ?> </li>

    The code works in the excerpt but not sure how to put it into the Read More code in functions.php

    (Read More Code)

    function excerpt_read_more_link($output) {
     global $post;
     return $output . '<a>ID) . '"> Read More</a>';
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');

Viewing 1 replies (of 1 total)
  • Thread Starter Tigaruk2

    (@tigaruk2)

    In case anyone else was looking for the answer.

    function excerpt_read_more_link($output) {
     global $post;
    
    global $product;
    return $output . '<a href="'. get_permalink($post->ID) . '"> Only ' . $product->get_price_html() . '</a>';
    }
    add_filter('the_excerpt', 'excerpt_read_more_link');
Viewing 1 replies (of 1 total)
  • The topic ‘How to get 'Read More' to display a price instead’ is closed to new replies.