Proper Javascript Implementation

If I interpret the question correctly you: Don’t have any .js javascript files Output any javascript you have from an .php file (presumably code) Include this javascript on the bottom of the page by including the .php file. So you are actually doing: Correct Combining all the javascript in one file Having the javascript in … Read more

Create single.php for specific category by category id

You can use this function to add category specific single template pages on your website. This goes in functions.php You can define as many single templates as you want. function wpse_category_single_template( $single_template ) { global $post; $all_cats = get_the_category(); if ( $all_cats[0]->cat_ID == ‘1’ ) { if ( file_exists(get_template_directory() . “/single-cat1.php”) ) return get_template_directory() . … Read more

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

How do I add a text input field for customers to leave a note on a single WooCommerce product page?

The best way to extend WordPress and WooCommerce is by using hooks. To add custom option field on products area, you can use the following hooks: woocommerce_product_options_advanced: used to add a custom field into the Advanced Tab woocommerce_process_product_meta: used to save/update field data in the database On your functions.php, you can add the following code: … Read more

Use touch_time() on front-end form via plugin

You might try to include the the template.php file: <?php if( ! function_exists( ‘touch_time’ ) ) { require_once( ABSPATH . ‘/wp-admin/includes/template.php’ ); touch_time( 0, 0, 5 ); } ?> but I think it might be better to just copy the code from the touch_time() function into your own function and modify accordingly. Friday part of … Read more

custom post type archive template per custom taxonomy term

I solved it. SOLUTION: <?php if ( has_term( ‘downloads’, ‘listen’, $post->ID ) ) { get_template_part( ‘templates/content-downloads-vergriffener-baende’ ); } elseif ( has_term( ‘untersuchungen’, ‘listen’, $post->ID ) ) { get_template_part( ‘templates/content-untersuchungen’ ); } elseif ( has_term( ‘studien-materialien’, ‘listen’, $post->ID ) ) { get_template_part( ‘templates/content-studien-materialien’ ); } elseif ( has_term( ‘sonderbaende-kataloge’, ‘listen’, $post->ID ) ) { get_template_part( ‘templates/content-sonderbaende-kataloge’ … Read more

New Template — copy existing template and change code? [duplicate]

For custom templates, I tend to use the default page.php, make any changes to the HTML (if need be), and enqueue an overriding stylesheet before get_header(): /** * Template Name: My Page Template */ wp_enqueue_style( ‘my-page-template’, get_template_directory_uri() . ‘/css/page-template.css’ ); get_header(); Everything’ll function like a normal page, except now you have a stylesheet for declaring … Read more

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