Theme not calling Jquery properly

If you register a script with wp_register_script() it is not neccessary to pass all the options in wp_enqueue_script() again. You can register the script in a central place and use the enqueueing it in diffenrent files. functions.php wp_register_script( ‘theme_script’, ‘path/to/script.js’, array( [dependencies] ), ‘1.0’, true ); […] if ( $condition ) require_once ‘file1.php’; else require_once … Read more

Different Subdomain changes page content

Just check the current host: add_filter( ‘the_content’, ‘domain_dependent_content’ ); function domain_dependent_content( $content ) { // get_the_ID() will return the current post ID if you need // more information about the current page. if ( ‘page’ !== get_post_type() ) return $content; if ( ‘au.example.com’ === $_SERVER[‘HTTP_HOST’] ) return “G’Day buddy!<br>$content”; if ( ‘uk.example.com’ === $_SERVER[‘HTTP_HOST’] ) … Read more

If ‘editor’ is empty, then

I’m using something of the sorts for delivering some standard default text if the post content is empty. Give this a whirl: <?php if( $post->post_content != “” ) { //do something or show content } else { //do something else }?>

Adding a line of text to php code

There is a difference between the home page and the front page. Since the code uses is_front_page I assume that is what you want, but check the Codex for the difference. I don’t know how your theme works, but it looks like the theme rolls several things into the “info bar”. The code you posted … Read more

Styling the second sidebar

Per the register_sidebars() Codex page, the CSS ID of the sidebars gets incremented by default. In other words, if you’re not explicitly setting the id array value — and in your code sample above, you aren’t — you would end up with sidebars with CSS IDs of sidebar and sidebar-2. You can then style them … Read more

How to modify the default feed via a function

You could try out the template_redirect action to overwrite the default feed template: add_action( ‘template_redirect’, ‘custom_template_redirect’ ); function custom_template_redirect() { if (!is_feed()) return; header(‘Content-Type: ‘ . feed_content_type(‘rss-http’) . ‘; charset=” . get_option(“blog_charset’), true); // your own template stuff here exit(); }

php include not working in custom page

WordPress has its own connection class, which can be used trough the $wpdb object. Is there a particular reason to use direct queries to the db, instead the wordpress functions (get_posts, get_post_meta, get_option)? Keep in mind that by doing this, you loose a lot of the wordpress tools, such as cache, filters, etc…

Should I use WordPress to skin a database website?

WordPress is an ecosystem of its own, and it’s pretty fat in terms of memory use and existing APIs and structures. Integrating this huge behemoth with a lean back-end that you have already built on your own won’t make much sense unless you specifically want to use WP’s back-end functionality instead of yours. WordPress themes … Read more