[Resolved] Using Copyright Bar w/ Multiple Short Codes

Home Forums Support Using Copyright Bar w/ Multiple Short Codes

  • This topic has 8 replies, 3 voices, and was last updated 2 months ago by David.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1377223
    Jon

    Hi, I’m not using an the Element, but trying to use the copyright bar (enabled in GP Premium Settings). And I’d like to display my affiliate links for GP and Flywheel (my host) using this format:

    © 2020 MATCHLESS WEB STUDIO, LLC | POWERED BY GeneratePress + Flywheel

    But when using the short codes I registered, likely incorrectly (see PHP below), the output is this:

    © 2020 MATCHLESS WEB STUDIO, LLC | POWERED BY +

    Where the only link output is the GP affiliate Link and it’s assigned to the “+” that should be in between the two links.

    Is there something that could be cleaned up with the PHP below that would correct my error?

    Or would it be better for me to scrap the copyright bar and use an Element to produce the effect I’m looking for?

    My site is https://matchlessweb.com/ if you’d like to have a look at the copyright bar with this output:

    function gp_affiliate_link() {
    return ‘‘;
    }

    add_shortcode(“GP”, ‘gp_affiliate_link’);

    function flywheel_affiliate_link() {
    return ‘‘;
    }

    add_shortcode(“Flywheel”, ‘flywheel_affiliate_link’);

    #1377427
    Leo
    Staff
    Customer Support

    Hi there,

    Not sure if I fully understand.

    Is there anything special about that link that requires a shortcode?

    #1377469
    Jon

    I don’t know that there’s anything special about the link, haha. I’m only trying the shortcode route because it says shortcodes are supported. I was assuming I’d need to enter a short code for a link to display there as there doesn’t appear to be WSYIWYG controls for styling things or inserting a link.

    If that section does in fact accept links in this format:

    a href=”https://matchlessweb.com/generate-press”<GeneratePress

    I could just use that instead. I don’t think I even tried dropping the links in that way.

    Note:

    Looking at my initial post, it looks like I didn’t get my copy/paste right, (oops). This is what is currently entered in my functions.php for making shortcodes out of the two links:

    function gp_affiliate_link() {
    return ‘‘;
    }

    add_shortcode(“GP”, ‘gp_affiliate_link’);

    function flywheel_affiliate_link() {
    return ‘
    ‘;
    }

    add_shortcode(“Flywheel”, ‘flywheel_affiliate_link’);

    #1377816
    David
    Staff
    Customer Support

    Hi there,

    can you test that the Flywheel shortcode works in the post content ?

    #1380310
    Jon

    I’ve just added each shortcode into its own paragraph block as well as the shortcode block to see if there was any different behavior between the two. See this page where I’m testing some things: https://matchlessweb.com/search starting at the orange background with the text “ATTN: GeneratePress Support – Shortcode tests in content below”

    As you can see, the shortcodes don’t return the desired links.

    What’s odd to me is the same shortcodes are what I’ve added to the copyright bar.

    But the only link that’s added is the GP link. The only problem with that is it’s being applied to the plus sign “+” between the targeted words “GeneratePress” + “Flywheel” instead of showing GeneratePress + Flywheel with their respective links on the text.

    For reference, my copyright bar has the following content:

    %copy% %current_year% Matchless Web Studio, LLC | Powered by [GP] + [Flywheel]

    #1380337
    Jon

    I’ve now replaced that copyright content with HTML to get the desired result. I may have just been going the long way around by trying to use shortcodes.

    But in light of the fact that the copyright area in the customizer says shortcodes are supported, I wanted to try it out.

    So I either failed to properly create/register my shortcodes or something funky is going on with the copyright area. If I add just a single one of those shortcodes to the copyright area, it just displays the text with square brackets.

    But as I found earlier, having the two shortcodes with a “+” in between assigned the GP affiliate link to the “+” and the Flywheel link wasn’t attached to anything.

    Maybe for this method to work I’m supposed to anchor each shortcode to the desired text somehow instead of trying to include the target link text in the HTML of the link that’s inside the shortcodes that I registered in my child theme functions.php? Haven’t experimented with that yet as I’m content to just use the HTML to get the desired effect you’ll see in the copyright bar now on this testing page for example: matchlessweb.com/search

    #1380380
    David
    Staff
    Customer Support

    It sounds like an issue with the Shortcodes themselves. But it looks like you found a working solution !

    #1381137
    Jon

    Yeah it wouldn’t surprise me if I fudged something up trying to create those shortcodes. The HTML links work just fine, so I’m sticking with that. Thanks for the support guys!

    #1381171
    David
    Staff
    Customer Support
Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.