Simple jQuery AJAX Request fails to run PHP Script

A simple answer to your question is that you have the data type as JSON in your ajax request and you are passing a string in it. You need to pass a json object in the ajax request when you chose dataType equals to JSON. A JSON object is typically a key pair value inside … Read more

Output only links using wp_nav_menu()

This should add the drop class to all the li elements in the menu and also add your classes to the wrapping ul: function wpse_232637_add_menu_parent_class( $items ) { foreach ( $items as $item ) { $item->classes[] = ‘drop’; } return $items; } add_filter( ‘wp_nav_menu_objects’, ‘wp_232637_add_menu_parent_class’ ); $args = array( ‘menu’=>”, ‘menu_class’=>’nav navbar-nav navbar-right’, ‘menu_id’=>”, ‘container’=>false, … Read more

WordPress site with embedded menu – gives You don’t have permission to access /wp-content/themes/xxx/taxonomy-redirect.php on this server

The server is setup correctly, no one should be able to execute php which is not at the root directory of wordpress (if he cares about the site’s security). You can look into the htaccess or other server settings to figure out how it was done and remove it, but -10 for that option. The … Read more

Unable to access WordPress functions from functions.php

check your header.php it should contain <?php wp_head(); ?> before the closing </head> tag. check your footer.php it should contain <?php wp_footer(); ?> before the closing </body> tag. You also need to hook your function to wp_enqueue_scripts action hook and then add wp_enqueue_script() and wp_enqueue_style() inside that function. e.g; function add_theme_scripts_styles() { wp_enqueue_style( ‘style-name’, ‘path_to_the_style.css’ … Read more

PHP Contact form

To access array values within a double quoted string use the form: $headers = “From: {$args[‘name’]} <{$args[’email’]}>” . “\r\n”; You are right: your function needs one more } to close it correctly.

Remove category from pagination

You are looking at the wrong line. $this_taxonomy is telling what taxonomy type (category, tag, custom tax, etc.) to look for, not what actual term in that taxonomy type. That being said, you should look at $previous and $next. More specifically, get_previous_post_link() and get_next_post_link(). The fourth parameter is $excluded_terms which is currently empty. The codex … Read more

WooCommerce: Display product categories to make IF statement

Try This Code <?php global $post; $terms = get_the_terms( $post->ID, ‘product_cat’ ); foreach ($terms as $term) { $product_cat_id = $term->term_id; break; } if ($product_cat_id == “6” && $product_cat_id == “7” ) { echo “aaabbb”; } else if ($product_cat_id == “6” ) { echo “aaa”; } else if ($product_cat_id == “7”) { echo “bbb”; } ?>