Hot answers tagged

9

If by 'blog page' you meant a static page set as posts page in the Reading Settings, then you could check it by doing this: if ( is_front_page() && is_home() ) { // Default homepage } elseif ( is_front_page() ) { // static homepage } elseif ( is_home() ) { // blog page } else { //everyting else } When you use is_home() and ...


7

Untested, but try: <?php echo get_the_title( get_option( 'page_for_posts' ) ); ?> But it's somewhat hackish. Really, the page_on_front and page_for_posts are intended to be nothing more than placeholders for the site front page and blog posts index page.


5

There is even an example in the WordPress codex here for this: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( 'cat', '-3,-8' ); } } add_action( 'pre_get_posts', 'exclude_category' ); Just modify ...


5

The function get_the_time is only designed to work either in the main WordPress loop or a custom loop using WP_Query, so the way you are using it won't work correctly. The following is the right way to use it, using a custom WP_Query loop: <?php // Get years that have posts $years = $wpdb->get_results( "SELECT DISTINCT YEAR(post_date) AS year FROM ...


4

You can use the following in your themes functions.php file: function is_blog () { return ( is_archive() || is_author() || is_category() || is_home() || is_single() || is_tag()) && 'post' == get_post_type(); } And then put this in the file you are checking: <?php if (is_blog()) { echo 'You are on a blog page'; } ?> You can use Hooks ...


4

The very broad answer for why this doesn't work is that the internet is stateless. Basically each request for a page is a separate and unique instance from other page requests. Example Let's say post-1 is in category-1 and category-2. When Wordpress loads post-1 on single.php it has no way of knowing how the user arrived at the page. It only knows that ...


3

I don't know if I'm covering everywhere the post functionality is linked from, but adding the following code to functions.php should at least remove the comments links from the administration menu, the toolbar, and the dashboard: add_action( 'admin_menu', 'remove_admin_menus' ); add_action( 'wp_before_admin_bar_render', 'remove_toolbar_menus' ); add_action( ...


3

Posts are a broader category than they initially appear to be. The post is any content, even if you're using WP as a CMS. While it might seem like a post is a blog post, really it's anything you post on the site. Disabling it will kill all content. Better to turn off the various bloggy components, such as comments, and then edit the template files to remove ...


3

WordPress now has a post format called status which is meant to be used for short status updates. You can see a lot of information about how to use these standard post formats in the Codex page on Post Formats


3

Actually your site is indexed all 176 pages. It would probably help your search results if you changed your permalink structure to something other than default. You should also get a yourself a Google Webmaster Tools account so you can see how your site gets indexed and crawled.


3

First, you need to familiarize yourself with the WordPress Template Hierarchy, so that you ensure that you are modifying the appropriate template file: Home: Blog Posts Index page; template file: home.php Front Page: Site Front Page; template file: front-page.php I am assuming that you want to display a static front page, and to display your blog posts ...


3

Create a shortcode to embed the content. This will always be synchronized. Sample code from an older project. Just updated. :) GitHub: https://gist.github.com/3380118 ยท This post in German (auf Deutsch) on my blog. <?php # -*- coding: utf-8 -*- /** * Plugin Name: T5 Embed Post Shortcode * Description: Embed any page, post or custom post type with ...


3

There are many options. Subscribe2 is very popular, although I've never been a fan. http://subscribe2.wordpress.com/ MailChimp and FeedBurner both offer RSS to Email delivery which can be used for this as well. JetPack includes a subscribe to new posts function as well: http://jetpack.me/2011/11/29/how-to-use-email-subscriptions-in-jetpack-1-2/


3

You need to use the_content instead of the_excerpt when you display your 'single' post. If you would post your code, you might get a more detailed answer.


3

Create a page with a custom page template, then create a custom WP_Query object to return your last posts. You can get something like: <?php /* Template Name: Blog Page */ get_header(); $args = array( 'post_type' => 'any', #all post types 'posts_per_page' => 10 #get 10 posts ); $query = new WP_Query( $args ); if($query->have_posts()): ...


3

When you make a page the page for posts, it's no longer a "page" in the conventional sense. Refer to the Template Hierarchy for home page display- the quickest fix is to rename your blog template home.php, and WordPress will load that before index.php.


3

The is_active_sidebar('Test'); function works correctly if the correct slug is used. I think that the problem is that you are constructing the sidebar ID like this: $sidebarID = preg_replace("/[\s_]/", "-", strtolower($page->post_title)); Then prepending sidebar- to it ... register_sidebar(array( 'name' => ...


3

An AJAX request is a new request to the server, and it is a request to admin-ajax.php. That is not a single post page. Any logic that depends on is_single() or any other page level template tags like it, won't work. If your AJAX callback needs that sort of information you must pass it to that callback in your AJAX request-- something like: function ...


3

First things first, avoid defining functions inside functions. PHP doesn't have a problem with it, but it's usually a sign you're "doing it wrong" and it just leads to unnecessary headaches. Second, your foreach loop at the bottom is a little malformed. You need to define the <ul> outside the loop, and then append to $html - otherwise you just end up ...


3

The standard query for posts uses orderby => 'post_date' and order => 'DESC'. The best candidate for arbitrary sort of posts would be orderby => 'menu_order' and order => 'ASC'. The menu_order is not generally used for posts but it is safe to be used. As suggested by Pieter Goosen use action hook pre_get_posts: add_action( 'pre_get_posts', ...


3

You have custom filter in a plugin or in your theme that is messing with WP_Query. Your issue is that something is setting is_home to false. This is not default behavior, by default, is_home should return true in any custom instance of WP_Query. is_home is one of the contributing factors which is responsible for setting up sticky posts at the top in a ...


2

I have to ask the obvious here; have you changed your privacy settings to allow the blog to be accessible by search engines. Blogs in general and WordPress blogs are typically well crawled by Google and the other search engines. If you have already made the blog visible, you may want to create a sitemap and submit it to the search engines. You can use the ...


2

You've got 2 separate issues here Word -> Wordpress: As @One Trick Pony said, the easiest way to sort this will be using the Paste from Word button on the post editing toolbar. Images will probably need to be inserted manually MathType -> WordPress: You'll need to install the Latex for WordPress plugin and use MathType to export the equations out in a ...


2

Setting your permalinks as /blog/%postname%/ will solve your structure problem. In your theme, drop in a home.php file which redirects the user to /blog/ and you can set the blog to appear on a page with slug blog as the blog in your Settings > Reading Regarding the menu, you would have to take a look how your theme works. If its using WP 3.0 menus, then ...


2

Set your blog as Blog category and your portfolio as Portfolio category. You might be also interested in Custom Post types (which I think is the right way to do it): Run your Blog as a usual via Posts and set the Portfolio as Custom post type with its own categories, tags or what ever taxonomy you need. Read more here: http://codex.wordpress.org/Post_Types ...


2

Is WordPress configured to use www or without www? Your server seems to be listening only for the www version and tries to redirect non-www requests to the www version. Considering that you provided a link to the non-www version of the domain above, my guess is that WordPress is trying to hook on to http://compassionpit.com, but your server redirects those ...


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 ...


2

Not sure if you can use a complete different template but you can use different template parts using the global $page variable. Example: global $page; if ( $page == 2 ) { get_template_part( 'page', 'two' ); } else { get_template_part( 'page', 'default'); } This would load the template file page-two.php or page-default.php depending on ...


2

You need to do three things: firstly, your markup is incorrect, take the container_24 div the main content sits in and make it grid_17 so it doesn't take up the entire width of the container div. The sidebar needs to go in the container div along with the content, else it will be pushed downwards by the container div Because of the above issues, you've ...


2

there's a meta tag in your body, causing refresh: <meta http-equiv="REFRESH" content="0;url=error.htm">



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