• I want to be able to link to the blog whether or not it is set as the front page:

    <a href="[?]">See all posts</a>

    This is for a public theme, so I don’t know whether the blog will be set to frontpage or assigned to a static page. And in any case I don’t know what the user will have named the static page. Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try <?php bloginfo('url');?>

    Thread Starter raskull

    (@raskull)

    That just takes me to the front page. Which is not necessarily the blog.

    Thread Starter raskull

    (@raskull)

    Holy effin’ bat urls… I did it! Good thing for them they aren’t paying me by the hour.

    If the posts page (where the blog is, aka is_home) happens to be the front page, the posts/blog/home page is the site url.

    Else the posts page is, and goes by the name of, whatever the user has set as their blog page (YOU don’t need to know).

    I created the get_home_url function, one that wordpress should build in, IMHO. Or at least they might have provided more documentation for page_for_posts…

    function get_home_url() {
    	if ( 'posts' == get_option('show_on_front') )
    		echo get_bloginfo('url');
    	else
    		echo get_page_link(get_option('page_for_posts'));
    }

    and

    <a href="<?php get_home_url(); ?>">see all posts</a>

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Link to blog page whether it is the front page or not’ is closed to new replies.