WordPress.org

Forums

JM Twitter Cards
[resolved] Modify Markup (6 posts)

  1. stephen_connolly
    Member
    Posted 1 year ago #

    Hello,

    I'm trying to modify the markup in particular the twitter:markup meta tag. Due to the way we have our testing site setup only relative paths are used for images.

    So I want to modify the markup to use the absolute path. I know this function jmtc_modify_markup can be used as it stated in the documentation:

    How do I go about manipulating the twitter:markup tag?

    Regards,
    Stephen

    https://wordpress.org/plugins/jm-twitter-cards/

  2. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, can you be more precise please? What are you trying to do? My plugin does not have any interaction with path. You paths can be curved by some code I guess.

    I'm just grabbing resources that are used in your post.

  3. stephen_connolly
    Member
    Posted 1 year ago #

    As I mentioned above due to the way of site is setup the twitter:image meta tag on the live site look like this:

    <meta name="twitter:image" content="/wp-content/themes/themename/images/twitter-card-default-logo.png"/>

    As you can see its just outputs relative path.

    Please note, your plugin is working fine, it does output the absolute path, but due to our setup we eventually end up with the relative path on the live site.

    I think I have found a way around it, by just using the following function:

    jmtc_modify_markup

    in the documentation you mention this can be used to filter the markup, so can I amend twitter:image meta tag using this function, if so how?

    PS I just noticed my initial post wasn't very clear, apologies for that.

    Regards,
    Steve

  4. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    Ah ok! You want to add some prefix before such as home_url() or some bloginfo() in order to keep your relative path because Twitter does not understant relative paths.

    Actually I think I picked the wrong term in my description. This is not actually about modifying the markup but more something like disable the markup for some condition with a filter.

    To do the kind of tricks you're looking for it would require some more hooks. I'll think about it for next updates. It might be interesting to play with paths if possible.

  5. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    I've added some new filters and wrote some snippets. See tab called "Other Notes".

    Do not forget to update to 4.3

    Hope it helps.

  6. tweetpressfr
    Member
    Plugin Author

    Posted 1 year ago #

    Marked it as resolved. I've tested it. It's working. Be careful anyway.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • JM Twitter Cards
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic