• Hey guys,

    I am trying to get a feel for shortcodes, but my test is not working properly. I want to to change [test] with <p>TEST TEXT</p>, but when I put [test] in the page editor, no text shows up.

    Here is what is in my functions.php:

    function test() {
      return '<p>TEST TEXT</p>';
    }
    
    add_shortcode('test', 'test');

    and then I have [test] as the only thing on the page. I am running on localhost, if that matters. Does anyone know what I am doing wrong?

    Thank you!

Viewing 13 replies - 16 through 28 (of 28 total)
  • Your custom theme’s functions.php is not being included.

    Please make sure it has activated properly and see this guide for creating a theme:
    https://codex.www.ads-software.com/Theme_Development

    If you follow the instructions for theme development, your theme will work.

    Thread Starter dstars5

    (@dstars5)

    That guide says that the functions.php should be automatically loaded if it is present. What do I need to do to “activate” it?

    Thread Starter dstars5

    (@dstars5)

    Bump. omg. Is everyone just that busy or am I just being ignored? If someone could just have a somewhat constant convo with me, this would be fixed by now.

    If someone could just have a somewhat constant convo with me, this would be fixed by now.

    Yeah, well, everyone helping out here is a volunteer, doing it on their own free time, so if you need better help, you should hire someone –

    https://jobs.wordpress.net/

    Probably going to be hard for anyone here to debug a custom theme. Did you read the article above? Have you tried any of these:

    https://codex.www.ads-software.com/Debugging_in_WordPress

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Is everyone just that busy or am I just being ignored?

    Look at this list of threads to get a scale of how busy we are: https://www.ads-software.com/support/view/no-replies – and take into account that we are helping out in our free time as WPyogi has identified to you.

    Thread Starter dstars5

    (@dstars5)

    I really don’t have a problem with waiting, and I understand that everyone here is a volunteer, but people just keep falling off this thread. I finally get someone who chimes in, then they’re gone, and I’m left waiting.

    Probably going to be hard for anyone here to debug a custom theme.

    What else do you need? Lapan said there was probably another function blocking it or something, so I posted my functions.php. Could you at least look at that and see if it is in fact a problem with my function.php?

    I just put that in a twentytwelve child theme functions file and it worked fine.

    Are you “using” the shortcode [test] someplace?

    Thread Starter dstars5

    (@dstars5)

    Like on the page?

    Yes, or in a post.

    Thread Starter dstars5

    (@dstars5)

    Ya I am using it.

    Thread Starter dstars5

    (@dstars5)

    Huh, ok so it turns out it is not just shortcodes. I figured I would start another part of the site that doesn’t need shortcodes, and the page just flat out does not show ANY text, shortcode or not.

    Thread Starter dstars5

    (@dstars5)

    Scratch that. I had messed with my index.php, and that messed it up. Normal text DOES work. Shortcodes still DO NOT.

    I don’t know what else to suggest – except to use the resources already posted above to figure out what’s wrong with your theme – someplace other than the functions file.

Viewing 13 replies - 16 through 28 (of 28 total)
  • The topic ‘Shortcode test leads to blank page’ is closed to new replies.