Featured Image field not appearing in Custom post type

use this code to create a custom post type, mainly you need to include this line: ‘supports’ => array( ‘title’, ‘editor’, ‘excerpt’, ‘thumbnail’, ), ” full code to create: // Register Custom Post Type function custom_post_type() { $labels = array( ‘name’ => _x( ‘Post Types’, ‘Post Type General Name’, ‘text_domain’ ), ‘singular_name’ => _x( ‘Post … Read more

How to get_template_directory() properly on local environment

get_template_directory() returns a filesystem path– that is, it returns the path to the file as it would appear if you were browsing it on the local machine via a file browser. Return Values (string) Absolute path to the directory of the current theme (without the trailing slash). https://codex.wordpress.org/Function_Reference/get_template_directory That is what you are seeing. The … Read more

How to pass variables from a function in functions.php to an other one

get_the_utm_vars doesn’t work like you think it does. A function cannot return more than one value. Right now, when the first return is reached, that value is returned and none of the following lines are ever reached. You could have get_the_utm_vars return an array of values instead: function get_the_utm_vars(){ $utm = array(); $utm[‘source’] = htmlspecialchars( … Read more

It does not work concatenation in function.php

the_post_thumbnail() echoes data immediate, what you want to try is get_the_post_thumbnail() which returns data so that you may concatenate properly. WordPress core functions that are prefixed with the_ usually echo, those prefixed with get_ usually return. See: https://developer.wordpress.org/reference/functions/the_post_thumbnail/ https://developer.wordpress.org/reference/functions/get_the_post_thumbnail/

Which function required?

Add <?php get_footer(); ?> into index.php or the template you are using Then create footer.php and add in something like this: <?php /* Always have wp_footer() just before the closing </body> * tag of your theme, or you will break many plugins, which * generally use this hook to reference JavaScript files. */ wp_footer(); ?> … Read more

Warning: Invalid argument supplied for foreach() in post.php [closed]

In WordPress 4.5.3, there’s a foreach in wp-includes/post.php on line 1177 and no others around it, so I’m guessing this is the one that’s triggering the error in your install on line 1172. This is inside the register_post_type() function, and it’s looping through the taxonomies argument that you’re sending through. Well… that you were meant … Read more