php - How can I dynamically widen navbar when user is on certain page -


i working on project uses wordpress plugin called learndash. within plugin navbar created containing links lessons. these lessons go lesson 15.

now issue having lessons 14 , 15 start on separate line below lessons 1 - 13 outside of navbar. how can navbar widen dynamically, when user on particular page?

any ideas? in advance.

<?php /**  * template displaying pages.  *  * template displays pages default.  * please note wordpress construct of pages  * , other 'pages' on wordpress site use  * different template.  *  * @package wordpress  * @subpackage wp_forge  * @since wp-forge 5.5.0.1  */  namespace hmba; include 'page-templates/hmba_funcs.php';  /* catch errors , report if in local enviorment. */ if (islocalhost()) {     error_reporting(e_all);     ini_set('display_errors', '1'); }  function getlessonnav($pillars, $pillarcurrent, $lessoncurrent) {     foreach ($pillars $key => $pillar) {         if (strpos($pillar['url'], $pillarcurrent) && array_key_exists('lessons', $pillar)) {             return $pillar['lessons'];         }     } }  // $actual_link = "http://$_server[http_host]$_server[request_uri]"; // current url. $current_path = $_server[request_uri];  // $current_path = '/pillar1-lesson1/'; $current_path = getpath($current_path); $pillarcurrent = $current_path['pillar']; $lessoncurrent = $current_path['lesson'];  $lessons_nav = getlessonnav($pillars, $pillarcurrent, $lessoncurrent);  get_header(); ?>      <style>         .pillars .top-bar .name {             background-color: #a54399;             border-radius: 29px;             margin: 0 5px;             float: left;         }         .pillars .top-bar .name {             color: #ffffff !important;             line-height: 17px !important;             padding: 4px 15px !important;         }         .pillars .top-bar .name.current {             background-color: #e99504;         }         .pillars .top-bar .name:hover {             background-color: #e99504;         }         .entry-title {             display: none;         }         section.content_wrap.row .top-bar {             background-color: #ffffff;         }         .nav_wrap{             background-color:#ffffff;         }         nav.lessons-bar {             background-color: #7a7a7a;             height: 35px;         }         .lessons-bar ul.title-area {             list-style-type: none;         }         .lessons-bar li.name {             float: left;             padding: 5px 10px;         }         .lessons-bar li.name a{             color: #ffffff !important;         }         .pillars .lessons-bar .name.current,         .pillars .lessons-bar .name:hover       {             background-color: #008c99;         }          /* learn dash style */         .entry-content #learndash_lesson_topics_list > div {             border: none;             border-radius: 0;             box-shadow: none;             margin-bottom: 0;         }         .entry-content #learndash_lesson_topics_list .topic {             background-color: #ffffff;             border: 1px solid #dddddd;             border-radius: 4px;             box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);             margin-bottom: 20px;             }         .learndash_topic_dots .topic-header {             background-color: #ccf6f4;             padding: 10px;         }         .entry-content .learndash .topic-notcompleted span {             background: none;             padding-left: 0px;              display: block;             text-align: center;             color: #444444;             font-size: 22px;         }      </style>         <div id="content" class="medium-12 large-12 columns pillars" role="main">          <div class="nav_wrap row">              <nav class="top-bar" data-topbar data-options="mobile_show_parent_link: true">                 <ul class="title-area">                 <?php foreach ($pillars $key => $tile) {  ?>                     <li class="name <?php if (strpos($tile['url'], $pillarcurrent)) echo 'current' ?>">                         <a href="<?php echo $tile['url'] ?>"><?php echo $tile['name'] ?></a>                     </li>                 <?php } ?>                 </ul>             </nav>                 <nav class="lessons-bar" data-topbar data-options="mobile_show_parent_link: true">                 <ul class="title-area">                 <?php if ($lessons_nav) foreach ($lessons_nav $key => $tile) {  ?>                     <li class="name <?php if (strpos($tile['url'], $lessoncurrent)) echo 'current' ?>">                         <a href="<?php echo $tile['url'] ?>"><?php echo $tile['name'] ?></a>                     </li>                 <?php } ?>                 </ul>             </nav>             </div>               <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', 'page' ); ?>                 <?php comments_template( 'comments.php', true ); ?>             <?php endwhile; // end of loop. ?>          </div><!-- #content -->  <?php get_footer(); ?> 

what trying edit nav class "lessons-bar"

i believe can putting class on main container page if it's on page. there's wp built in function can tell page are.

you can try doing one:

<div id="page" class="hfeed site <?php if(is_page( 'lesson-1-page' )) echo 'wide-content';?>">  

i believe starting element can found on header.php, try , edit there.

then on css add :

.wide-content {   width: "specify-your-wider-width-here"; } 

resources: https://codex.wordpress.org/function_reference/is_page


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -