How to define category ID in an array?

As Geert pointed out, your current conditional will always be true. An if() construct needs to be fed an expression. You’re feeding it a valid array, so that’s true. Always. So far this is basic PHP, regardless of whether in a WP environment or not. As can be read in Chris_O’s comment if ( is_category(‘some-cat’) … Read more

Javascript file not included only on home page

This might be because of two issues: Unique handler is not used to enqueue scripts on homepage Path to the file is wrong Unique Handler You should use unique script handler while enqueuing scripts or styles using wp_enqueue_*, I see that you used script as your script handler which is pretty generic and is not … Read more

Shortcode to include PHP file, pass various parameters to include?

Thanks for your comments and guidance. I implemented solutions which didn’t reinvent the wheel. The complication was finding a way to remove the [insert_php][/insert_php] wrapped code from pages and posts and still preserve the content and user experience. Custom Template Pages Pages and Posts which were almost entirely PHP were made into custom template files. … Read more

Adding a wp_head hook from an included PHP file

To enqueue styles and scripts properly, use the wp_enqueue_scripts action like so: function wpa_63708_enqueue_scripts() { wp_register_script( ‘my-script’,’/path/to/script’ ); wp_enqueue_script( ‘my-script’ ); } add_action( ‘wp_enqueue_scripts’, ‘wpa_63708_enqueue_scripts’ );

Shortcode return is printing a 1 afterward

You are returning the result of calling include. You want to grab the output of the included file and return than instead. Use output buffering to do that. function build_total_search_method( $atts ) { ob_start(); include( dirname(__FILE__) . “/includes/total_search.php” ); $shorcode_php_function = ob_get_clean(); return $shorcode_php_function; } add_shortcode( ‘total_search’, ‘build_total_search_method’ );

Shortcode not passing variable to included file

Ok, so somehow I got it working by changing it to this: It looks like it didn’t like ‘the_clientId’. Maybe it just doesn’t like capital letters???? [insert-form form_location=”form.php” identification_number=”12345″] function insert_the_form($atts){ $form_base = plugin_dir_path(__DIR__); // Shortcode attributes & options $atts = shortcode_atts( array( ‘form_location’ => ‘NULL’, ‘identification_number’ => ‘NULL’ //Variable for client ID ), $atts, … Read more

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