How do I point bloginfo(‘stylesheet_directory’) to my parent theme?

If the parent theme is properly coded, the following code in the child theme functions.php file should load the parent css. <?php add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ ); function my_theme_enqueue_styles() { wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ ); } ?> As for the javascript, I think that if the parent theme loads theme with wp_enqueue_scripts they should work … Read more

CPT in a shortcode

You should use ob_start() and ob_get_clean() for that. Also it looks like you’re not using any attributes so you can ditch the call to shortcode_atts() <?php // List judges shortcode function judges_shortcode($atts){ ob_start(); the_content(); $judges = get_posts(array( ‘numberposts’ => -1, ‘post_type’ => ‘judges’, ‘meta_key’ => ”, ‘meta_value’ => ” )); if ($judges) { ?> <div … Read more

How to take shortcode and content separately from a page?

I found the solution. I used the following codes and it worked for me . To remove the shortcode from the content, I Used this <?php $content = get_the_content(); $content = preg_replace(“/\[.*]/m”, ” “, $content); $content = apply_filters(‘the_content’, $content); $content = str_replace(‘]]>’, ‘]]>’, $content); echo $content; ?> and the following code to get the shortcode … Read more

Replacing entire tag with shortcode – JavaScript [duplicate]

This looks like javascript. do_shortcode is a php function. I’m not sure the full context, but at the very least, you need to wrap your php function in php tags like this and add an echo: <?php // Start of php file ?> <script> var stockcounter = document.getElementsByClassName(“stock in-stock”); if(stockcounter[0].innerHTML==’0 in stock’) { //Displays timer … Read more

display number of posts by category Shortcode

OK, so the code is wrong, because there are a lot of errors in it: Shortcodes should return its results and they shouldn’t print anything. Shortcode callback takes an array of attributes as first param and not an ID. You don’t do anything with the parameter of your shortcode callback. You don’t pass any ID … Read more