Print page content with formatting when doing custom SQL query

You need to run the post_content filters. It is a one line change from your current code. This… echo $footerElement->post_content; … should be … echo apply_filters(‘the_content’,$footerElement->post_content); That will give you all the same formatting as with normal posts. You can of course pick and choose which filters you want to run, instead of running them … Read more

Page Title repeating

look into header.php of your theme; <title><?php bloginfo(‘name’); ?><?php wp_title(); ?></title> when you use a seo plugin, you can control the meta title with the plugin; change that line to: <title><?php wp_title(); ?></title>

How to bypass 404 for certain pages/posts?

When you add a custom post type, WordPress doesn’t know that it needs to regenerate it’s permalinks/rewrite rules. Visit the permalinks settings page to flush and regenerate the links and your custom post type permalinks will start to work, else you’ll get 404 messages. A word of warning: Some people will advise you call flush_rewrite_rules … Read more

Using index.php as page template

You can use it as a page template, just as any file with such a header can be used. That doesn’t necessarily mean it’s a good idea. The template hierarchy already uses index.php as a last resort if it cannot find an appropriate template for a page/post/listing etc, so a specific page will already have … Read more

How to make title for home to be News, but if page has parent then its name else just post/page name

Put this in your functions.php: function my_title() { if (is_home()) echo ‘News’; else { global $post; if ($post->post_parent) echo get_post($post->post_parent)->post_title; else echo $post->post_title; } } // function my_title and then use <?php my_title(); ?> anywhere you want. The above code prints News on the home page, for child posts the name of their respective parent, … Read more

Two different pages that share the same content?

Have you take a look at Options Page Add-on for Advanced Custom Field? http://www.advancedcustomfields.com/add-ons/options-page/ I created an option page for my client once where they enter promotion content once in that options page, and display that same information elsewhere via widget, shortcode, and PHP functions. It costs 25AUD but it’s unlimited license and is well … Read more

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