Maria Reyes-McDavis
asked 10 years ago

What I’m asking is:  How do I make extra pages and link to them, so that they do not have to be in the “extra menu” to not redirect. 
Right now, all pages I create (that I don’t want on the “one page” homepage) redirect to the homepage with “#home” added to the end of each url.
I do not want to have these pages in the “extra menu” — they are backend pages that I want to link to from anywhere on the website (e.g. backend pages customers see when opting in to free offer, etc).
You’ve stated in previous threads that DW Page Retro (and all child themes) are only compatible up to WordPress 3.5.2 (on sales page for theme). I downgraded to this version and it still does not work. 
I’ve also de-activated all plugins, to no avail.
Thank you!
M

Maria Reyes-McDavis
replied 10 years ago

Reiterating my question: “Right now, all pages I create (that I don’t want on the “one page” homepage) redirect to the homepage with “#home” added to the end of each url.”

Please note, this includes any addition content, all links (blog posts, pages, etc) redirect to the correct URL with #home at the end–ultimately taking every link (unless it links outside of the website) within the website, to the homepage.

Also note, I purchased DW Page Retro from Creative Market.

I’m certainly not a newbie, this has me stumped.

1 Answers
Wilfred
answered 10 years ago

Hi Maria, 
To resolve this issue, please follow my instruction here:
1. Open framework.php file in /wp-content/themes/your-theme/inc/framework.php
2. Add the following code – line 172 (See screenshot)

foreach ($menu_items as $key => $menu_item) {
if ($menu_item->attr_title) {
unset($menu_items[$key]);
}
}

3. Replace the following code – from line 319 to line 325 (See screenshot)

?>
<li <?php echo $active ?>>
<a href="#<?php echo $menu_id ?>">
<?php echo $menu_item->title ?>
</a>
</li>
<?php

With:

if ($menu_item->attr_title) {
?>
<li><a href="<?php echo $menu_item->url ?>"><?php echo $menu_item->title ?></a></li>
<?php
} else {
?>
<li <?php echo $active ?> ><a href="#<?php echo $menu_id ?>" data-onepage="true"><?php echo $menu_item->title ?></a></li>
<?php
}

4. Open nav-menus-hook.php file in /wp-content/themes/your-theme/inc/nav-menus-hook.php 5. Replace the following code – form line 19 to line 26 (See screenshot)

$title = $_REQUEST['menu-item-section-title'][$menu_item_db_id];
$excerpt = $_REQUEST['menu-item-section-attr-title'][$menu_item_db_id];
$page_id = get_post_meta($menu_item_db_id,'_menu_item_object_id', true);
wp_update_post( array(
'ID' => $page_id,
'post_title' => $title,
'post_excerpt' => $excerpt
) );

With

$title = isset( $_REQUEST['menu-item-section-title'][$menu_item_db_id] ) ? $_REQUEST['menu-item-section-title'][$menu_item_db_id] : '';
$excerpt = isset($_REQUEST['menu-item-section-attr-title'][$menu_item_db_id]) ? $_REQUEST['menu-item-section-attr-title'][$menu_item_db_id] : '';
$page_id = get_post_meta($menu_item_db_id,'_menu_item_object_id', true);
if( $page_id ) {
wp_update_post( array(
'ID' => $page_id,
'post_title' => $title,
'post_excerpt' => $excerpt
) );
}

6. Add following to line 110 (See screenshot)

$title = $title ? $title : $item->post_name;

7. Open script.js in /wp-content/themes/your-theme/inc/assets/js/script.js  Replace following code – form line 36 to line 40 (See screenshot)

$('#nav .nav a').click(function(e){
e.preventDefault();
var des = $(this).attr('href');
goToSectionID(des);
})

With: 

$('#nav .nav a').click(function(e){
if ( $(this).data('onepage') ) {
e.preventDefault();
var des = $(this).attr('href');
goToSectionID(des);
}
});

8. Add “false” to “Title Attribute” for the links of the extra pages (see screenshot)
 
Hope this helps!

Gwen M
replied 10 years ago

Could I use this code (or similar code) to address the same issue in the current version of DW Page (1.0.6)?

Dominic Staff
replied 10 years ago

At the moment, in the version 1.0.6 does not yet update this issue. So, you can do as previous answer that Wilfred provided.
Hope this helps !

Powered by DW Question & Answer Pro