Auto-Generate Longtail-SEO Pages/URLs

Hm, likely if there are complete lists of options for “mood” and “location” than there could just be a script that generates all combination of them and – while generating – double check if there is actually enough content for them. And then put them in the sitemap that google uses for getting to know … Read more

Is it possible to have two different previews of a post (ie. two templates for one post)?

The easiest way to solve this is to create a special template file for previews, that will show the post twice in the different layouts. The following code will use the single-preview.php template file if it exists: add_filter( ‘single_template’, ‘wpse15770_single_template’ ); function wpse15770_single_template( $templates ) { if ( is_preview() ) { $templates = locate_template( array( … Read more

Generic taxonomy-term template page

Simply use taxonomy-{taxonomy}.php. Refer to the Template Hierarchy Codex entry regarding taxonomies. WordPress will look for taxonomy template files in the following order: taxonomy-{taxonomy}-{term}.php – If the taxonomy were sometax, and taxonomy’s slug were someterm WordPress would look for taxonomy-sometax-someterm.php. taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php taxonomy.php archive.php index.php … Read more

How to check if searchform.php is being included as widget?

Check if searchform is included? The get_search_form() function (that should be used) uses locate_template(‘searchform.php’); to display the search form. The later returns (as you can see from its source) the template filename if one is located So if you’re just wanting to catch the default way, then you should simply test ‘searchform.php’ === locate_template( ‘searchform.php’ … Read more

Display HTML only if Custom Field has a Value

You can use the “get_sub_field” to test for the subfields. If nothing is returned and they are empty, it won’t show the content associated with the if statement. <?php if ( get_field(‘ingredients-list’) ) { echo ‘<ul class=”ingredientsList”>’; while ( has_sub_field(‘ingredients-list’) ) { echo ‘<li class=”ingredient” itemprop=”ingredients”>’; echo ‘<label for=””>’ . get_sub_field(‘quantity’) . ‘&nbsp; ‘; if … Read more

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