Using Includes in Templates in Document Head

Including PHP files inside actions isn’t recommended, and is considered highly unusual. If what you were trying to do worked, it would be fragile, and heavily dependent on ordering. The reason your code didn’t work: add_action(‘wp_head’, ‘fst_include’,20); Is because actions are added with a priority of 10 by default, yet your include is on priority … Read more

What’s the correct way to include files in WordPress TwentyTen theme with it’s own jquery scripts and css?

You need to have the script in a separate file (normally it would be filename.js; I suppose filename.php would work?). Then, you need to register and enqueue that script file, using wp_register_script() and wp_enqueue_script() e.g.: function mytheme_register_custom_scripts() { if ( ! is_admin() ) { $scriptsrc = get_stylesheet_directory_uri() . ‘/scripts/filename.js’; wp_register_script( ‘mytheme_slider’, $scriptsrc ); } } … Read more

Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons

Ok, this is what I did: First, I replicated classes/class-twentynineteen-svg-icons.php to the child theme. Renamed to class-mytheme-svg-icons.php. Added a extend with my New_SVG_Icons class: class New_SVG_Icons extends TwentyNineteen_SVG_Icons { /** * Gets the SVG code for a given icon. */ public static function get_svg( $group, $icon, $size ) { if ( ‘ui’ == $group ) … Read more

WordPress “include TEMPLATEPATH” or?

Long answer short: the absolute-best answer, for template-part files in a subdirectory, is to use locate_template() I would recommend referencing the stylesheet path for template file includes, so that those template part files can be easily over-ridden by Child Themes. So, ideally, you should use get_stylesheet_directory_uri(). Some differences/explanation of all the functions listed by @kaiser: … Read more

Include files for a plugin not including

In your main plugin file, use plugin_dir_path to define a constant that you can then use in all of your includes. see the example on the above codex page. // define the constant in your main plugin file define( ‘MYPLUGINNAME_PATH’, plugin_dir_path(__FILE__) ); then, to include your file: include MYPLUGINNAME_PATH . ‘includeme.php’;

How to rename wp-includes folder?

Unfortunately not at the moment. If you look in wp-includes/default_constants.php, the WP_CONTENT_DIR and other constants all have a if ( ! defined(constant) ) check before them. WPINC (the wp-includes constant) does not. It’s defined in wp-settings.php, and has no if ( ! defined(WPINC) ) check, so defining it before hand (in your wp-config.php) would just … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)