How to implement template file and the loop

I have seen that there is extra (); so maybe this syntax error prevent display in front-end please try below code – <?php /** * Template Name: Basic Test */ get_header(); if ( have_posts() ) : while ( have_posts() ) : the_post(); the_title(); endwhile; else : _e( ‘Sorry, no posts matched your criteria.’, ‘textdomain’ ); … Read more

What is the advantage of using home.php over index.php for the front page

If you look here [is_home vs is_front_page] you’ll see that is_front_page() is true regardless of what the homepage is set to in the WordPress settings. This means that if you don’t plan on releasing this publicly (i.e. short-run usage) then just having a front-page.php should suffice. is_home() is set based on your blogs page (which … Read more

AJAX requests within templates

Security through obscurity isn’t a good pattern to follow. You have to have a URL to make XHR or JSONP calls. Anyone who knows anything about searching the DOM using developer tools, Firebug, etc… can easily find your remote script URL. To me, this is the wrong question to ask. The more relevant question to … Read more

load_textdomain won’t load my .mo file

I found the answer: load_textdomain( ‘site-map’, TEMPLATEPATH.’/partials/languages’ ); … gives the path of the folder containing the .mo file. but the path of every individual mo file should be used in its own load_textdomain instruction : load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-fr_FR.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-en_US.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-es_ES.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-ru_RU.mo’); load_textdomain(‘site-map’, TEMPLATEPATH.’/partials/languages/site-map-de_DE.mo’); Shame on me it is a very obvious and … Read more

How to make a template for a specific post of a custom post type?

As Pages are a special built in Posttype, they get an own template hierarchy. Other “normal” post types and custom post types can only be templated by “single-$posttype.php”. You can however hook into the single_template filter and make wordpress redirect to your template file: function get_custom_post_type_template($single_template) { global $post; if ($post->post_type == ‘account’) { $located … Read more

How to display page content and a list of posts on the same page?

php file add the following code snippet <?php get_header(); ?> <?php while ( have_posts() ) : the_post(); ?> <?php the_title( ‘<h1>’, ‘</h1>’ ); ?> <?php the_content(); ?> <?php endwhile; // end of the loop. ?> <?php $post = array( ‘post_type’ => ‘post’, ‘order’ => ‘ASC’, ‘post_status’ => ‘publish’ ); $loop = new WP_Query( $post ); … Read more

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