Amazon Link
[resolved] Amazon Prices in Titles (3 posts)

  1. satanin
    Posted 3 years ago #

    Hi, Thank you for this awesome plugin.

    I would like to put the product price in product titles but the plugin only parses the content and widget, is there any solution to this?.

    Thank you!


  2. paulstuttard
    Plugin Author

    Posted 3 years ago #

    Hi Raúl,

    There are a number of ways to add this functionality...


    You could hack it into the plugin by editing the file 'amazon.php', find the line:

    add_filter('the_content', array($this, 'content_filter'),15,1);             // Process the content

    and adding the line immediately after it:

    add_filter('the_title', array($this, 'content_filter'),15,1);             // Process the title


    However if you upgrade the plugin this will be lost, so you could add the following into some plugin or theme file e.g. in 'functions.php' add:

    function add_amazon_titles ($opts, $al) {
       add_filter('the_title', array($al, 'content_filter'), 15,1);
    add_action ('amazon_link_init', 'add_amazon_titles', 10,2);


    Or you change your themes template to call the Amazon Link plugins functions directly, e.g. in your themes 'single.php' files where it displays the title add some code like:

    $ASIN = get_the_title();
    if (function_exists(amazon_shortcode)) echo amazon_shortcode("template=price&asin='$ASIN'");

    Just some ideas, I haven't tested them thoroughly!


  3. satanin
    Posted 3 years ago #

    Sorry for this late resp

    Thank you very much for all the solutions provided. I tried about 1 month ago your solutions but they didn't worked and I quit trying for a while. Today I decided to try again and now I figured out what I was doing wrong, my mistake was that in my code this line

    add_filter('the_content', array($this, 'content_filter'),15,1);

    is like this
    add_filter('the_content', array($this, 'content_filter'),15);

    and each time I was adding this line
    add_filter('the_title', array($this, 'content_filter'),15,1);

    I was getting a global error. Today I've modified this
    add_filter('the_title', array($this, 'content_filter'),15,1);
    to this
    add_filter('the_title', array($this, 'content_filter'),15);
    and voilá! I have the prices in my article titles.

    Thank You very much!!

    P.S: sorry my english, I hope is good enought to be understood

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Amazon Link
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.