• Resolved DuneDx

    (@dunedx)


    Hi

    Is it possible to edit publicize to point to a specific URL depending on which category is added to a post?

    I have created a page to host a number of posts from two categories and would prefer publicize to point visitors toward this hosting page rather than the individual post items.

    Unsure where to start editing to do this.

    Thanks
    Dune

    https://www.ads-software.com/plugins/jetpack/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    Are you referring to the URLs shared when using Jetpack Sharing buttons?

    If you’d like to set up custom sharing links depending on the category being used, you can use the sharing_permalink filter to overwrite the link used by all the buttons for a specific post.

    In the example below, I used the filter to customize the link and add tracking parameters:
    https://jeremy.hu/jetpack-add-utm-tracking-to-sharing-buttons/

    You could use this as a starting base, and change the link completely depending on the category.

    Thread Starter DuneDx

    (@dunedx)

    Hi Jeremy
    Many thanks for replying only just had the chance to try your suggestion. This is for the link automatically shared on Twitter and Facebook when I publish a post not the sharing buttons on the post.

    Thread Starter DuneDx

    (@dunedx)

    Me again,

    Jeremy I think it is similar to this request you answered last year : https://www.ads-software.com/support/topic/customize-url-in-jetpack-publicize?replies=5

    basically for any post that is category 12 or 13 I want to point to a specific URL

    Sorry I’m only just learning so this is most definitely wrong but do I add something like this to function?

    $status_update = apply_filters( 'publicize_twitter_message', $message, $post, $url );
    if ($post->is_cat('-12 -13')) {
        return
            $url ='https://reading-rampage.co.uk/results';
    }
    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    This is for the link automatically shared on Twitter and Facebook when I publish a post not the sharing buttons on the post.

    In this case, you won’t be able to customize the link sent to Twitter and Facebook. While you have control over the sharing buttons, Publicize messages are sent from WordPress.com servers, and you consequently have limited ways of customizing those messages.

    We’re working on adding more options to allow you to customize those messages, though, and you can follow our progress here:
    https://github.com/Automattic/jetpack/issues/261

    Until then, I’m afraid you won’t be able to customize those links.

    Hey @jeherve, I have a similar but I think slightly different need. I need to override the URLs that are used in the Publicize posts that go out when you publish an article with Publicize active. Would the filter mentioned here work for that or is there a different one?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    @maccast The filter I mentioned above will only work with sharing buttons, not with Publicize. I’m afraid it’s currently not possible to customize links shared via Publicize.

    Is there possibly a workaround using a regex and a hook on the Publicize message?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic ??

    I’m afraid not. The URLs are sent from the WordPress.com servers, making it a bit more difficult to customize the code on your end right now. We do plan on adding more options to customize each element of the Publicize messages in the future though; you can follow our progress in the GitHub issue I posted above.

    Great. Thank you for your replies and the info. I’ll keep an eye on the GitHub.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Publicize – point to custom url’ is closed to new replies.