Skip to main content

Timeline for Shortcode not showing anything

Current License: CC BY-SA 3.0

10 events
when toggle format what by license comment
Oct 5, 2015 at 14:27 comment added phatskat @dswebsme not even sure how mine got accepted but I'll take it :P
Oct 5, 2015 at 14:26 comment added dswebsme Thanks for the nod @phatskat. You win this round =] Upvoted!
Oct 5, 2015 at 14:23 comment added bonger Please note though phatskat that your example is right and your clarification is wrong! Shortcodes ought to return their output not echo it as birgire said otherwise it will just appear randomly in the output...
Oct 5, 2015 at 14:18 comment added JoaMika ok sorry i had to disable some other code in my theme for it to work.. phewww
Oct 5, 2015 at 14:18 vote accept JoaMika
Oct 5, 2015 at 14:17 history edited phatskat CC BY-SA 3.0
More edits as the real problem comes up
Oct 5, 2015 at 14:14 comment added phatskat Ok, so a little of each of these answers contains your final solution: the init hook. You're registering your shortcode on init, but my guess is that init has already happened by this point. Try replacing the add_action line with a direct call to register_ashcodes() instead.
Oct 5, 2015 at 14:10 comment added JoaMika ok still not showing anything with this code. I am placing it in the functions.php of my child theme. I know the code runs because otherwise it would just display [ashtopbar]. I am calling this like <?php echo do_shortcode("[ashtopbar]"); ?>
Oct 5, 2015 at 14:10 history edited phatskat CC BY-SA 3.0
Didn't test code before suggesting it was wrong
Oct 5, 2015 at 14:01 history answered phatskat CC BY-SA 3.0