• Resolved lazyym

    (@lazyym)


    Hi Greg, Auto Affiliate Links used to work with WP adverts. Can you answer a question for the developer so we can try to make it work again?

    He asks…

    Lucian Apostol @thedark asks

    Hello. You could ask them if there is a filter hook that other plugin developers can use to modify the content displayed by wp adverts.

    Thanks!

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    to make the AAL plugin work with WPAdverts details pages you will most likely need to execute the WPAdverts detail rendering with a higher priority.

    You can do that by adding the code below in your theme functions.php file

    
    add_action( "init", function() {
      remove_filter('the_content', 'adverts_the_content', 9999 );
      add_filter('the_content', 'adverts_the_content', 10 );
    }, 200 );
    
    Thread Starter lazyym

    (@lazyym)

    Thanks,

    I’ve tried it and that doesn’t seem to work…..

    Try this one:

    add_action( "init", function() {
      remove_filter('the_content', 'adverts_the_content', 9999 );
      add_filter('the_content', 'adverts_the_content', 3 );
    }, 200 );
    Thread Starter lazyym

    (@lazyym)

    That did it! Thanks Lucian! And Greg!

    Thread Starter lazyym

    (@lazyym)

    Darn it! Unfortunately it breaks my form buttons and css for the content in ads!

    Any ideas?

    • This reply was modified 6 years, 8 months ago by lazyym.
    Plugin Author Greg Winiarski

    (@gwin)

    What is the page URL?

    Thread Starter lazyym

    (@lazyym)

    I emailed your support email address with before and after screenshots Greg. I have it turned off right now because it breaks ads.

    Plugin Author Greg Winiarski

    (@gwin)

    I got your message you should receive a reply via email soon.

    Thread Starter lazyym

    (@lazyym)

    Thank you Greg!

    Wanted to share your reply so someone else might find it useful…

    One thing you can try doing is add the below code in your theme functions.php file, if these are actually the <p> tags which are causing a problem then it should fix it

    add_action( “init”, function() {
    if( is_singular( “advert” ) ) {
    remove_filter( ‘the_content’, ‘wpautop’ ); } } );

    If this will not help try replacing “init” with “wp_loaded” or “wp” and try again.

    I am a huge fan of the 2016 theme and still use it on this site. What worked in my case in 2016 was replacing init with wp as your email suggested.

    Awesome support as usual, thanks again!

    Thread Starter lazyym

    (@lazyym)

    Taking this a step further @gwin, is there a simple way for these links to be disabled when or after a user purchases a featured ad option? So that Auto Affiliate Links do not work in featured ads.

    I’ve also always thought it would be nice to have an area at the top of featured ads where it states “This is a Featured Ad!”. And then a link to what featured ads are….

    Thanks sir!

    • This reply was modified 6 years, 8 months ago by lazyym.
    Plugin Author Greg Winiarski

    (@gwin)

    One way to do that would be to update the code from one of the previous messages to look like this

    
    add_action( "wp", function() {
        if( is_singular( 'advert' ) && get_post( get_the_ID() )->menu_order > 0 ) {
          remove_filter('the_content', 'adverts_the_content', 9999 );
          add_filter('the_content', 'adverts_the_content', 3 );
        }
    } );
    
    Thread Starter lazyym

    (@lazyym)

    Thanks Greg, that doesn’t seem to work. Lucian had fixed the core files with the previous issue is why probably. Any other ideas?

    Plugin Author Greg Winiarski

    (@gwin)

    I am not sure how to connect it to Auto Affiliate Links but most likely you will need the following code template in your theme functions.php file

    
    add_action( "wp", function() {
        if( ! is_singular( 'advert' ) ) {
            // this should be run on Ad details pages only
            return;
        }
        if( get_post( get_the_ID() )->menu_order > 0 ) {
          // current post is a featured Advert -> enable Auto Affiliat Links in the_content
        } else {
          // current post is NOT a featured Advert -> disable Auto Affiliat Links in the_content
        }
    } );
    

    You will need to update the snippet with code which will enable/disable the Auto Affiliate Link, how to do that i am not sure but something like

    
    add_filter( "adverts_the_content", "auto_affiliate_links_callback" );
    

    should be enough, where auto_affiliate_links_callback is an actual name of a function which will convert the text in Ad description to affiliate links.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Auto Affiliate Links?’ is closed to new replies.