Tag Info

Hot answers tagged

16

is_front_page() returns true if the user is on the page or page of posts that is set to the front page on Settings->Reading->Front page displays So if you set about us as the front page then this conditional will only be true if showing the about us page. is_home() return true when on the posts list page, This is usually the page that shows the ...


7

I would just add a rewrite rule to your .htaccess file of something like: Redirect 301 /oldpage.html http://domain.com/newpage/ see: http://www.javascriptkit.com/howto/htaccess7.shtml


3

Well first of all, if you set your page as the static front page, you don't need to associate the template with the page, and the template doesn't need a header. WordPress automatically uses the front-page.php template for a static front page, as per the template hierarchy. To answer your question though, you need to call the_post() first to set up the ...


3

wp_reset_query(); or consider saving your $wp_query result into $my_query = new WP_Query(); if( $my_query->have_posts(); etc. Just take a look at the codex page.


2

Your slider needs to be created from a second, custom Loop. There are a few options, including using $my_query = new WP_Query(), however, generally speaking, my preference is to use $my_query = get_posts(). If you post your slider code, we can help you customize it properly.


2

Maybe take a look inside the 2010 theme that comes packaged with WP, index.php shows a call to a loop file: <?php get_template_part( 'loop', 'index' ); ?> so you could (well this is how i would do it, cos i think it looks neater, but you could use multiple loops) create 2 new loop files for example they could be called loop-economy.php and ...


2

I achieved that using WP-Cron capabilities. add_action('wp', 'wpse_26170_activation'); function wpse_26170_activation() { if ( !wp_next_scheduled( 'wpse_26170_update_readme_page' ) ) { wp_schedule_event( current_time( 'timestamp' ), 'daily', 'wpse_26170_update_readme_page'); } } function wpse_26170_update_readme_page() { $page = array( ...


2

I was working with wp_cron last week in a plugin and we have a fight and are no longer on speaking terms, but for reference this is what I do; 1) - set the scheduled cron event on register_activation_hook 2) - remove the scheduled cron event on register_deactivation_hook If you are concerned that your scheduled cron event might get wiped from the database ...


2

You don't really have a Loop. <?php get_header(); ?> <div class="content"> <div class="welcome_area"> <div class="welcome_area_title"><?php the_title('');?></div> <div class="welcome_area_text"><?php if (have_posts()) { while (have_posts()) { the_post(); the_content(); } } ?> What is happening ...


2

WordPress does have a way of doing what you want. Make them all top level pages. Unless you have a good reason not to.


2

Is there any particular reason not to use the front-page.php template file, and just not bother with trying to pull WordPress headers into external files? Using the front-page.php template file is easy: Create a new static Page, with any arbitrary name (let's call it "Front Page") Go to Dashboard -> Settings -> Reading and set "Front Page Displays" ...


2

You could add a rewrite rule to your theme that sends requests for page.html to the page itself. I'm not confident to supply code, but the rewrite documentation on this page is helpful. The last example there is the simplest illustration I've found of query rewriting. It helps to use ugly permalinks while you're arranging it as you get to see what requests ...


2

I want to make a static about page for my wordpress site. I don't like the format of the wordpress static pages that are managed through the control panel... But that's how the WordPress CMS is designed to be used. For static pages, create static pages. so I thought I would make my one custom page where I would have full control of the layout, ...


2

Your question is quite unclear, that's probably why you are getting inconsistent answers. If you want Google not to follow you (or any search website), you could use, as recommend by WPMU-DEV Ari, "Search Engine Visibility" which can be found in the Settings -> Reading menu. However remember, search engines are not forced to listen and/or obey your request. ...


2

Assuming you have shell access, or access to any Linux/Unix box, you could use wget to download the entire site to static html files: wget --recursive --no-clobber --page-requisites --html-extension --domains domain.com http://domain.com Then either upload or move these files to your web root (after backing up and removing your WP installation). I imagine ...


2

Weird Problem!, try the following: Make sure that the targeted categories are not empty. If you are using custom post type,include it in the query 'post_type'=>'advertisement' for example. If the targeted categories are special taxonomies,make sure to include it in the query : 'term'=>'cars' along with child 'cars'=>'toyota'. in this example and ...


1

In your wp-content/themes/your-theme folder you need create your own page template... CUSTOM PAGE TEMPLATE In the same folder where you just created your new file, you should see a file named page.php. Open that file by choosing to edit it, and then copy everything you find inside of it. Then, at the very top of the page, you will need to place some code ...


1

Edit the template file, such as page.php and remove the include or call to <?php comments_template(); ?>. What theme are you using?


1

First, Welcome! I guess you use the file front-page.php for displaying your homepage. What you have to do, is add the following code into your front-page.php: <h2>Recent Posts</h2> <ul> <?php $args = array( 'numberposts' => '5' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ ...


1

Ah - got it - was almost there with the new WP_Query, but was failing to call the query method on it... This works perfectly: <?php $excerptQuery = new WP_Query(); $excerptQuery->query('showposts=6'); ?> <?php if ( ...


1

So long as you have a standard page template header in your map-template.php, you can use the Custom Post Template plugin (which essentially allows you use templates on posts in the same way you do with pages). Update: Perhaps you might be better off using shortcode. For example; This is my post content in the editor. And here is a map; [my-map] And in ...


1

According to the following page Live Writer can manage pages as of Beta2. http://en.support.wordpress.com/xml-rpc/windows-live-writer/ Maybe it's simply a case of waiting to use the newer version that includes page management? I don't use WLW myself, but a quick google did garner the above link, so hope it helps.


1

Put everything into WordPress. This way, you can search your entire content from the built-in search engine, and you can edit each piece. If you need pages with special markup create templates for your theme. Naked Template <?php /* * Template Name: Naked * * That’s the complete template! */ Basic HTML5 <?php /* * Template Name: Basic HTML5 ...


1

I would suggest making your own page template. Start by moving the files into your WordPress theme folder, and giving them a name. Like page-foo.php, page-bar.php, so on. Then on the top of these new files add PHP like the below, changing the Template Name to something that makes sense to you. <?php /* Template Name: Foo */ ?> Then place your ...


1

Not exactly, WordPress determines it's query from the URL structure, so: www.example.com/my-sub-page/ would be the exact same structure as www.example.com/my-other-top-level-page, so WordPress would have no way to tell if you are looking for a subpage or a top level page. Having said that, I don't think WordPress lets you have the same slug for a sub level ...


1

First there are a bigger difference between posts and pages and in your case it would be that posts have categories and pages don't. Anyway the simplest way to achieve what you described would be to create 4 categories, and use posts. use the same template for all categories but in your sidebar use category posts widget to list the posts from that ...


1

You said you wanted to create a "template" for each of the 4 categories. Creating a page template may be a little more technical than you're ready for if you're just getting started with wordpress, but that depends on your coding knowledge. How comfortable are you with HTML, CSS, & PHP? Also, if you're interested in creating real page templates to use ...


1

The standard WP RewriteRules ignore files and directories that "exist". Example: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress This the rewrite rule set for ...


1

You can use a fantastic plugin called CDN Linker.


1

Create a file front-page.php as a copy your index.php. Add the slider code on top of the page. WordPress will now take care of the pagination for you. If you need the slider on the first page only wrap it into a conditional: // First page if ( empty ( $GLOBALS['paged'] ) or 1 == $GLOBALS['paged'] ) { // slider code } // the regular loop follows



Only top voted, non community-wiki answers of a minimum length are eligible