• Resolved dealfiles

    (@dealfiles)


    As outlined on another thread, I have copied my shortcodes.php file to my Child Theme directory, and now I want to require the file using the Child Theme’s functions.php file, but i am uncertain how to do this.

    I am trying to customize the ‘listings’ shortcode to include new Properyy details that I set up in the functions.php file.

    Thanks.

    https://wordpress.org/plugins/wp-listings/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author agentevolution

    (@agentevolution)

    Add to your functions.php:

    require_once get_stylesheet_directory() . '/shortcodes.php' ;

    Thread Starter dealfiles

    (@dealfiles)

    Thanks, but when I add that line to my theme’s funtions.php, it breaks the theme.

    Plugin Author agentevolution

    (@agentevolution)

    What is the error? That should point you in the right direction. You probably need to edit the shortcodes.php and rename the shortcode and its function so they have a different namespace than the default shortcodes.

    Thread Starter dealfiles

    (@dealfiles)

    I’m not sure what the exact error is, but it freezes my WordPress dashboard, and no changes are made to the site, so I believe it’s still pulling from the shortcodes.php file in the plugin folder, rather than the one in the theme folder.

    Plugin Author agentevolution

    (@agentevolution)

    Yes, it is, and it will. Which is why you need to change the name of the shortcode and the functions in your custom shortcodes file.

    Thread Starter dealfiles

    (@dealfiles)

    Bingo!

    Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Modifying functions.php to include shortcodes.php’ is closed to new replies.