tags:

views:

56

answers:

2

Im trying to remove the https:// and replace it with a non secure link for my wordpress navigation. This only happens when I view a secure page the wp_list_pages adds https:// Ive tried this

$sslnav = wp_list_pages('title_li=&sort_column=menu_order&exclude=');
$sslnav = str_replace("https", "http", $sslnav);
echo $sslnav;

but the nav links remain the same with https in them

A: 

Try placing this function in your theme's functions.php file:

function wp_list_pages_custom() {
  $array = array();
  $pages = wp_list_pages('echo=0&title_li=');

  foreach($pages as $key => $page)
  {
    $array[$key] = str_replace('https', 'http', $page);
  }

  return $array;
}

Now instead of using wp_list_pages, use wp_list_pages_custom.

Sarfraz
A: 

Try including the echo query var in the arguments. This will stop WordPress from showing the list of pages and return the result in your variable.

$sslnav = wp_list_pages('title_li=&sort_column=menu_order&exclude=&echo=0');
$sslnav = str_replace("https", "http", $sslnav);
echo $sslnav;
kevtrout