• rtcunningham

    (@rtcunningham)


    Okay, I’ve set up the WordPress AMP plugin and the related posts appear where they belong at the bottom of the page, with one thing wrong and it’s not your fault.

    The endpoint is /amp/ and that isn’t part of the related posts plugin. If this was part of the content, I could do a str_replace(). I don’t know what hook to filter, if there’s a different one.

    Should I just edit the theme file to use something like:

    $related = crp_related_post();

    And do my string replace there?

    Is there an easier way?

    https://www.ads-software.com/plugins/contextual-related-posts/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter rtcunningham

    (@rtcunningham)

    I ended up hacking the output-generator.php file:

    if ( function_exists( ‘is_amp_endpoint’ ) && is_amp_endpoint() ) {
    $endpoint = ‘amp/’;
    } else {
    $endpoint = ”;
    }

    and then get_permalink( ID ) . $endpoint . (the rest of the string) in three places.

    The only thing that’s iffy is the endpoint, which can be changed.

    Plugin Author WebberZone

    (@webberzone)

    Does this give you the desired output and effect?

    Should it be the case of filtering get_permalink to make it universal in that case?

    Thread Starter rtcunningham

    (@rtcunningham)

    Yes, it works the way I thought it would. The only thing that could change is the endpoint (I’m not going to change mine).

    Filtering get_permalink? I don’t think that’s a good idea. The is_amp_endpoint function has to exist and it isn’t in the core.

    Plugin Author WebberZone

    (@webberzone)

    My idea was to filter ‘post_link’ which is from https://developer.www.ads-software.com/reference/functions/get_permalink/

    For your code above, what does a full URL look like?

    I thought about adding a hook earlier, but since I’m using the_permalink I didn’t feel the need for this

    Thread Starter rtcunningham

    (@rtcunningham)

    https://www.rtcx.net/seasons-weather-philippines/amp/

    I didn’t read into it but I saw that AMP works without permalinks as well.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘CRP Related Posts for AMP Plugin’ is closed to new replies.