Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialErica Yoroni
3,264 PointsMay you kindly help with the following code that is not working.
error inc/front-end.php must be required
<?php function my_plugin_shortcode ($atts, $content = null) { global $post; extract(shortcode_atts( array( 'num_courses' => '4' ), $atts)); }; ?>
function my_plugin_shortcode ($atts, $content = null) {
extract(shortcode_atts(array( 'num_courses' => '4' ), $atts) ); ob_start(); require( 'inc/front-end.php' ); $content = ob_get_clean(); return $content; }
?>
<?php
function my_plugin_shortcode ($atts, $content = null) { global $post; extract(shortcode_atts( array( 'num_courses' => '4' ), $atts)); }; ?>
function my_plugin_shortcode ($atts, $content = null) {
extract(shortcode_atts(array(
'num_courses' => '4'
), $atts) );
ob_start();
require( 'inc/front-end.php' );
$content = ob_get_clean();
return $content;
}
?>
2 Answers
Nathan Thomas
13,477 PointsHello,
The issue may be with your PHP syntax. You have a closing php tag after your function definition, hence the greyed out code below it.
If removing it doesnβt fix the error message, check out this Wordpress article, which may help.
https://codex.wordpress.org/Determining_Plugin_and_Content_Directories
Erica Yoroni
3,264 PointsThanks