using the loop with a custom table
You should use wpdb to query the database and then insert them into the loop (loop.php).
You should use wpdb to query the database and then insert them into the loop (loop.php).
I’m having trouble doing the same for a page that is called from WP Settings as the “Posts Page”. Let’s say at the top of the “Blog” page (a WordPress page), I want some intro text to the blog that says, “Welcome to the blog. Please check out new posts below.” Instead of hardcoding that … Read more
You’re missing part of your post <div> Look through your loop and you’ll see something that’s not closed or something. It will more than likely look like this <?php the_ID(); ?>” <?php post_class(); ?>> When it needs to be something like <div id=”post-<?php the_ID(); ?>” <?php post_class(); ?>> Hope that helps.
Your template must have the the_content() function called within the WordPress loop to show up the text you’ve entered while creating new post. You might have missed the the_content() function in your custom template, that function retrieves and show the content of your page. Here is sample usage <?php get_header(); ?> <div> <?php if (have_posts()) … Read more
http://codex.wordpress.org/Function_Reference/get_sidebar <?php get_sidebar(‘other’); ?> for instance will call the template sidebar-other.php you would add the dynamic_sidebar() code in that sidebar-other.php template; see also http://codex.wordpress.org/Widgetizing_Themes
In your index template, you’ll want to add a conditional around your Google ad. The subject of that conditional is up to you, and will depend on your exact needs. For instance, if you want it to show on the homepage but not other pages, you can check if is_home(). If your needs are more … Read more
If you want don’t want to show content if the current template is template-custom.php or template-custom2.php you can use: if (!is_page_template(‘template-custom.php’) && !is_page_template(‘template-custom2.php’)) { <!– show some content when you AREN NOT in template-custom.php NOR template-custom2.php –> } or if (is_page_template(‘template-custom.php’) || is_page_template(‘template-custom2.php’)) { <!– show some content when you ARE in template-custom.php OR template-custom2.php … Read more
Page template is set in a post meta field keyed ‘_wp_page_template’ so, instead of using raw $wpdb query, you can run a WP_Query using ‘author’ argument and meta_query to retrieve pages from a specific author that also have a specific templates: $q = new WP_Query( array( ‘author’ => $user->ID, ‘post_type’ => ‘page’, ‘meta_query’ => array( … Read more
The correct way to load footer-none.php is: get_footer(“none”); Anyway, I think it can be better to use wp_footer() (required function on any frontend page) directly in the page template file so you don’t need to load any empty footer template (assuming you load all required HTML tags in the page template, for example closing body … Read more
You can use wp_get_referer(); to get a URL of previous page from where user came. Then get the last slug part of the URL. Then compare if the slug matches with slug of your custom search-result page template. Then you can decide whether to show or not to show ‘Back to search results’ link. Please … Read more