Featured image fallback link to permalink

I have updated your code so that the fallback image has post permalink. I hope this helps: if ( has_post_thumbnail() ) { echo ‘<a href=”‘ . get_permalink($post->ID) . ‘” >’; the_post_thumbnail(); echo ‘</a>’; } else { echo ‘<a href=”‘ . get_permalink($post->ID) . ‘” ><img src=”‘. get_stylesheet_directory_uri() . ‘/img/fallback-featured-image.jpg” /></a>’; }

Page-Linking Structure

As @Milo mentioned in his answer, you can’t and shouldn’t directly call a template file. It is a security risk, and you will no longer be able to access WordPress’s engine, so you can’t use functions such as the_permalink. To include a template part in your home.php or any where you wish, you can use … Read more

Custom post type – how can I make it a sub-url of another page?

When you register the CPT, use the rewrite argument to add the prefix. For example if your CPT is currently registered like this: <?php function wpse_create_cpt_testimonial() { $args = array( ‘public’ => true, ‘label’ => __( ‘Testimonials’, ‘textdomain’ ), // … you probably have other arguments as well ); register_post_type( ‘testimonial’, $args ); } add_action( … Read more

Changing permalink changes stylesheet path?

At a guess I’d say you’re linking to your stylesheet with a relative url like so: <link href=”https://wordpress.stackexchange.com/questions/6643/wp-content/themes/my-theme/style.css” rel=”stylesheet” /> so when you end up anywhere other than the home page it’s looking at the full URL plus the path indicated to your stylesheet. Make sure your stylesheet URL begins with a slash if you’re … Read more

wordpress upgrade has broken my permalinks

Here are some steps for you a) Access you site through ftp and remove .htaccess file (possibly backup it) b) Go to admin of your site (wordpress admin) and open permalink settings form c) set the first option to custom and put the value in text box /%category%/%postname% d) save changes and check you front-end … Read more