Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Homepage other than Activity or Admin Blog (or a WP page)


Anointed
Participant

@anointed

This is going to sound really nuts, but it works for me.

I start by adding a file to my theme with the following:

/*
Template Name: Page-Redirect
*/

if (function_exists('have_posts') && have_posts())
{
while (have_posts())
{

// get the post
the_post();

// get content
ob_start();
the_content();
$contents = ob_get_contents();
ob_end_clean();

// correctly build the link

// grab the 'naked' link
$link = trim(strip_tags($contents));

// work out
if(! preg_match('%^http://%', $link))
{
$host = $_SERVER['HTTP_HOST'];
$dir = dirname($_SERVER['PHP_SELF']);
$link = "http://$host$dir/$link";
}

// navigate to the link
header("HTTP/1.1 301 Moved Permanently");
header("Location: $link");
exit;

}

}

All I have to do then is create a new page, assign the Page-Redirect template to the page and the magic works by simply adding a url to the content area.

What it gives me is a page that when accessed immediately redirects to whatever link you put in the content. ‘you do not need http stuff just the path to the page like — groups/

Because it’s a true wp page, now you can select that page in your settings for the homepage.

like I said, very hacky but it works for now. Hope it helps

Skip to toolbar