waitek
Forum Replies Created
-
Forum: Networking WordPress
In reply to: Dynamic or variable home link in shared primary nav – MUI’ve decided to use PHP sessions to hang onto the initial home link variable. Can’t seem to maintain that variable otherwise.
So I’m initializing the session in the functions.php file.
if ( !session_id() ) add_action( 'init', 'session_start' );
Tried setting the home page variable there too, but no luck. So I’ve coded that into the header–so it checks to see if the site visitor is entering on a subsite that contains a numeric id with this pattern 000-00000. If so, a home page variable is set accordingly:
if (!$_SESSION['aawid']) { $current_url = get_site_url($current_blog_id); $aaw_id_pattern = '/[0-9]{3}\-[0-9]{5}/'; preg_match($aaw_id_pattern, $current_url, $aaw_id); $_SESSION['aawid'] = $aaw_id[0]; $_SESSION['aawhome'] = "adoptaworker.org/".$_SESSION['aawid']; }
The above works great. The issue I’m having is using that variable as the home page link in the menu.
When I use the following code, the home menu item is appending my desired link at the end of the URL for the current page:
$aawhome = 'https://adoptaworker.org'; if ($_SESSION['aawhome']) $aawhome = $_SESSION['aawhome']; wp_nav_menu( array( 'theme_location' => 'primary', 'items_wrap' => '<ul><li id="item-id"><a href="'.$aawhome.'">Home</a></li>%3$s</ul>' ) );
So, instead of adoptaworker.org/000-00000, I’m getting the current page URL *plus* adoptaworker.org/000-00000.
I’ve looked through the codex info on WP menus, but I haven’t figured out how to override WP or force it to use just the variable I’m providing. Are the WP menu links in an array? I’m probably overlooking something really obvious here :/.
Forum: Networking WordPress
In reply to: Dynamic or variable home link in shared primary nav – MUThank you. I’ll dig into this.
Forum: Networking WordPress
In reply to: Dynamic or variable home link in shared primary nav – MUOK. Haven’t been under the hood for nav stuff–just relied on WordPress to spit it out. How or where would I tweak the code to affect just the home link?
Forum: Themes and Templates
In reply to: Northern Web Coders theme breaks in 1.5.1Thank you for the responses. Another solution came from the theme developer:
In the header.php file, the following line:
<?php wp_list_pages(‘sort_column=time_modified&title_li=’); ?>
needs to change to:
<?php wp_list_pages(‘title_li=’); ?>