Function won’t run onclick using Ajax

1) Is your function working? First do a console.log( “it’s working” ); inside your function and check it on your browser’s console. If it’s not showing when you click, you must refactor your function. 2) Have you defined ajaxurl? Unlike on the admin side, the ajaxurl javascript global does not get automatically defined for you, … Read more

Post type no single page

First, before you start, just reflush your permalinks. It is sometimes strange why the Template Hierarchy fails. You code checks out, and should in theory work. Everything checks out, and to make sure, I tested it on my side. You can use this work around to “force” wordpress to use a template. Here we would … Read more

Warning: join(): Invalid arguments passed in post-template.php

You did not returning the default class if you are not viewing the contact page. Try this code once if(! function_exists( ‘remove_hentry’ )) { function remove_hentry( $classes ) { $classes[] = customTheme_layout_class(); if( is_page(‘contact’) ) { $classes = array_diff( $classes, array( “hentry” ) ); } return $classes; } add_filter( ‘post_class’, ‘remove_hentry’ ); }

Redefine function arguments before rendering

Redefining a WordPress core function that might be used all over the place by the core, the theme or plugins isn’t a very good idea in my opinion. Because it might be used in those occasions expecting the default value to be what default is, which might lead to breaking things. So it is actually … Read more

is_page Funtion for Posts ?

Remove the ! before is_page(). The function is_page() is built into WordPress and only tests if the post being viewed is a page or not. The ! stands for “not”, so if you take it out, the code will only return true on that part if it is a page.

wp_star_rating() – Adding a 5 star rating system to theme

Instead of redefining wp_star_rating() for the front end, you should be able to just use the built-in function. From the Codex page for wp_star_rating(): In order to use this function on the front end, your template must include the wp-admin/includes/template.php file and enqueue the appropriate dashicons CSS font information. (emphasis mine) A code sample is … Read more

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