• First, Secondary Title plugin works great. Thank you for building it.

    I am using the plugin to create an alternative page title leaving the <h1> available for SEO content. I have changed the page template php so the SEO/h1 lives outside the header, elsewhere on the page. The secondary_title is looking and acting (mostly) like I want it to, but I think I’ve hit a limitation, so am looking for suggestions.

    All but the home page of our wp site have additional page menus created using the child pages of the parent. The secondary_title functions are not working in page menus (maybe because its a loop?). So I am stuck with the secondary title of the current page appearing in all the menu items rather than the child’s secondary titles. Example: The page menu for the Pricing page reads: | Pricing | Pricing | Pricing | Pricing |.
    I am working on this issue on our stage site, so link to problem is a challenge. To see how the interior menu/pages currently work on the site without the secondary title plugin, visit our site: https://www.circonus.com/
    Suggestions? Work-around ideas? Or the obvious answer that I missed? All would be very much appreciated. -kellyanne

    The following may be way more than what you are interested in, but just in case:

    Basically I swapped out functions within the php that creates the internal page menu…

    <h1><?php the_title(); ?></h1> replaced with <h7><?php the_secondary_title($post_id, $prefix, $suffix); ?></h7> This swap is working.

    <?php echo $feature->post_name ?> replaced with <?php get_secondary_title_link(); ?> This swap is working, except on child interior page menu.

    <?php echo $feature->post_title ?> replaced with <?php echo $feature->get_secondary_title ?> This swap is working.

    Here’s a snippet from the template/php that creates interior page menu. Hope the backticks work the code

    <div class="secondarymenu" style="background:url('/wp-content/uploads/2015/03/sec-pg-bg-1.jpg') no-repeat 0 0;">
    
    <?php do_action('vantage_entry_main_top') ?>
    
    <h1><?php the_title(); ?></h1><?php //check for root page
    
    if (empty($post->post_parent)) {
    
    $root = $post->post_name;
    
    $parent = '';
    
    $features = get_pages(['child_of' => $post->ID, 'parent' => $post->ID, 'sort_column' => 'menu_order']);
    
    } else { //find the parent page in the root
    
    $parent = get_page($post->post_parent);
    
    $features = get_pages(['child_of' => $parent->ID, 'parent' => $parent->ID, 'sort_column' => 'menu_order']);}?>
    
    <?php if (!empty($features)): ?>
    
    <ul class="secondarymenu" >
    
    <li class="<?php if ($post->post_parent == "0"){ echo("how-onsection");}?>" 
    
    onclick="location.href='/<?php echo the_parent_slug(); ?>'"  style="cursor:pointer;"><?php echo $root->post_title; ?> Overview</li>
    
     <?php foreach ($features as $feature): ?>
    
    <li class="<?php if ($feature->post_name == $post->post_name){ echo("how-onsection");}?>" 
    
    onclick="location.href='<?php echo $feature->post_name ?>'";  
    
    style="cursor:pointer;"><?php echo $feature->post_title ?></li>
    
    <?php endforeach; ?>
    
    </ul>
    
    <?php endif; //features ?>
    
    </div>

    https://www.ads-software.com/plugins/secondary-title/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter demibold

    (@demibold)

    Correction:
    <?php echo $feature->post_title ?> replaced with <?php echo $feature->get_secondary_title ?> This swap is working.

    Should read:
    <?php echo $feature->post_title ?> replaced with <?php echo $feature->get_secondary_title ?> This swap DOES NOT work.

    If wishes were ponies…

    Plugin Author thaikolja

    (@thaikolja)

    A lot of custom stuff going on there which is making it a bit difficult for me to replicate the issue. I’ll see what I can do.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to secondary titles of child pages in php menu’ is closed to new replies.