Return child theme url

The correct function to use here is get_stylesheet_directory_uri(). Please feel free to read this useful post by @ChipBennet regarding this issue Your use of syntax is also wrong in your return statement as already pointed out. A variable is php, not html, therefore you don’t need the single quotes which are used to wrap html … Read more

Dequeue script to prevent javascript event conflict on wordpress child theme

First of all, to resolve the javascript conflict I’ve set up a simple tl_custom.js under my theme js/ folder, with the following code jQuery(document).ready(function($) { // Remove handler set by themes/Divi/js/custom.js at line 2642 $( ‘a[href*=#]:not([href=#])’ ).off(); }); Then I add the script with the following code in functions.php function tl_custom_scripts() { if ( ! … Read more

Child Theme Fatal Error [closed]

Your child theme’s functions.php file should be an empty file to which you can add code specific to your child theme. It appears you have copied the functions.php file from the parent theme instead. See this note about functions.php in Child Themes: Unlike style.css, the functions.php of a child theme does not override its counterpart … Read more

Link featured image to post

Theme customisation is off topic however the default themes are exempt so lets look at an example of how its done in Twenty Fifteen. if ( ! function_exists( ‘twentyfifteen_post_thumbnail’ ) ) : function twentyfifteen_post_thumbnail() { if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) { return; } if ( is_singular() ) : ?> <div class=”post-thumbnail”> … Read more

How to correctly enqueue the parent and child theme stylesheets in the creation of a child theme? [duplicate]

Check this codex page. In the event that a child theme is being used, the parent theme directory URI will be returned. So if you want to include your other css files you just need to all your CSS files: add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’ ); function theme_enqueue_styles() { wp_enqueue_style( ‘parent’, get_template_directory_uri() . ‘/style.css’ ); wp_enqueue_style( ‘custom-handler-one’, … Read more

How to create and populate with few links a menu in child theme functions.php?

Here you go. Since you already have the menu-id all you need is: $menu_item_defaults = array( ‘menu-item-db-id’ => $menu_item_db_id, ‘menu-item-object-id’ => 0, ‘menu-item-object’ => ”, ‘menu-item-parent-id’ => 0, ‘menu-item-position’ => 1, ‘menu-item-title’ => ‘Play Game’, ‘menu-item-url’ => ”,//not sure is a blank is ok here ‘menu-item-description’ => ”, ‘menu-item-attr-title’ => ”, ‘menu-item-target’ => ”, ‘menu-item-classes’ … Read more