Custom Permalink Structure for Pages & Posts
Go to “Settings” -> “Permalink” page and set custom structure for permalinks equals to /news/%postname%.
Go to “Settings” -> “Permalink” page and set custom structure for permalinks equals to /news/%postname%.
Your htaccess file seems to be a little off. I would suggest the first part of the file should look like the following… <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /testsite/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /testsite/index.php [L] </IfModule> And that you store it in the ‘testsite’ folder not the root.
Your theme’s body_class can be used to target specific pages: body.home /* front and subsequent pages */ body.paged /* any page *except* front page */
You can use wp_insert_post to insert a physical page, though I would suggest creating one page for the plugin and then using a rewrite rule to give all of your items a URL with that single page as the base. EDIT quick rewrite example with added query var: function wpa55546_rewrites(){ $page_slug = ‘your-page’; // urls … Read more
Since you are saying it’s a “Page”, I believe you should try is_page instead of is_home: <?php if ( is_page( ‘about’ ) ) { // Code to be shown on Page whose slug is “about” } ?> OR for the way your code is, this should do: <?php if ( is_page( ‘about’ ) ) { … Read more
Page templates don’t work that way. The way they work is that you create a normal Page, and then select your custom Page Template to display it with. The URL of the resulting Page is determined by the permalink structure and slug you selected.
Declare the following function in your functions.php function wpse58346_wp_list_pages( $pages, $r ) { foreach( $pages as $key => $page ) { if ( 50 < $page->menu_order ) unset($pages[$key]); } return $pages; } Now before calling wp_list_pages() apply a filter as follows add_filter(‘get_pages’, ‘wpse58346_wp_list_pages’, ”, 2); And after you have called wp_list_pages() you can remove the … Read more
<!– displays total number of posts for query, ignoring pagination –> <?php echo $wp_query->found_posts ?>
add a simple counter and conditional check: $pages = get_pages(‘child_of=10’); $counter = 1; if ($pages) { echo ‘<ul class=”projectthumbs”>’; foreach ($pages as $page) { if ($counter == 3){ $class=” class=”YOUR_CLASS””; $counter = 1 }else{ $class=””; $counter = $counter +1; } echo ‘<li’.$class.’><a href=”‘.get_permalink($page->ID).'”>’; echo get_the_post_thumbnail($page->ID); echo ‘<span class=”projectthumbtitle”>’; echo get_the_title($page->ID); echo ‘</span>’; echo ‘</a></li>’; } … Read more
Use a WP Nav menu or the built in APIs instead. They all have current cat/active/parent highlighting on posts/pages, all out of the box