Shortcode issue
-
Hi there, I’m not sure if I’ve posted this problem in the correct section of the forum. I hope someone can help either way.
I’m attempting to add some shortcode to the bottom of my posts. I’ve so far had sucsess adding the below code to my function.php file.
add_shortcode('stuart', 'stuartBotPost'); function stuartBotPost() { return ' <div class="whoweare"> <img src="https://www.gravatar.com/avatar/b80039d3cf7dbfdf4d25130b06c08802.png" alt="mini Stu"/> <h4>About the author</h4> <p>Stuart Edwards is the co-head Honcho at Am I Nearly There Yet?. He likes travelling, single malt whiskey, web design and all things techie. Not necessarily in that order. Read more about Stuart <a href="https://aminearlythereyet.com/authors">here</a>.</p> </div>'; } add_filter('widget_text', 'do_shortcode');
That works fine. Now when I add another shortcode, it results in failure and the page fails to load.
add_shortcode('eloise', 'eloiseBotPost'); function eloiseBotPost() { return ' <div class="whoweare"> <img src="https://www.gravatar.com/avatar/e44c4f6b5e6d25ff3ae8ef328c014099.png" alt="Eloise mini"/> <h4>About the author</h4> <p><p>Eloise Rodgers is the co-founder of Am I Nearly There Yet?. When not seeking out the best local vegan cuisine, she's travelling the globe looking for it. She likes vintage things and making beautiful <a href="https://thehatqueen.com" target="_blank">hats and head pieces</a>.Read more about Eloise <a href="https://aminearlythereyet.com/authors">here</a>.</p> </div>'; }
Now, if I delete the bulk of the content within the <p> tags, it works. I’ve experimented a little bit. If I leave the bulk of the content the same as the [stuart] shortcode, it works fine! What’s that about?!
add_shortcode('eloise', 'eloiseBotPost'); function eloiseBotPost() { return ' <div class="whoweare"> <img src="https://www.gravatar.com/avatar/e44c4f6b5e6d25ff3ae8ef328c014099.png" alt="Eloise mini"/> <h4>About the author</h4> <p>Eloise Rodgers is the co-head Honcho at Am I Nearly There Yet?. He likes travelling, single malt whiskey, web design and all things techie. Not necessarily in that order. Read more about Stuart <a href="https://aminearlythereyet.com/authors">here</a>.</p> </div>'; }
Is there a maximum character allowance within the shortcode that causes this to fail?
Does the shortcode formatting have to be exactly the same as the shortcode above it?
I’m not a PHP whizz unfortunatley. I just can’t figure this out, seems totally bizzare!
- The topic ‘Shortcode issue’ is closed to new replies.