1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[HELP] with a little code add on for a page tab

Discussion in 'White Hat SEO' started by phobia2381, Sep 2, 2013.

  1. phobia2381

    phobia2381 Junior Member

    Joined:
    Nov 3, 2012
    Messages:
    180
    Likes Received:
    263
    Location:
    Error 404! The Freedom you were looking for could
    Sorry, I couldn't open a thread in Web design since I'm not an jr Vip..

    I need a little help with adding a new page tab on my theme. It is a wp theme but the theme you can't just add another tab with the menu so I wanna add another tab and point it to a specific page I have already created. The tabs are in the header php file.. The code I can see from the start of the page tabs I have listed below.
    I wanna create a tab that says "thc meme generator" and have it point to my page here "http://www.mydomain.com/thc-meme-generator/

    Could anyone help me out, since I'm a noob to these things, thanks and rep will come..

    Code:
    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xml:lang="en" lang="en" xmlns:fb="http://ogp.me/ns/fb#"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="<?php echo $site_description; ?>" />
    <meta name="author" content="Theme Developed by VOZAX" />
    
    
    <meta name="keywords" content="Funny Pictures, Epic Fails, Funny Planet, iPhone Autocorrects, Awkward Texts, LOL Photos, TheFunnyPlanet, Hilarious, Animal LOLs, Troll Comics, Gags, Cartoon , Humour, Funny Facts, Movies, Epic win, Justin Bieber Jokes & More... ALL at One Place! ">
    <link rel="shortcut icon" type="image/x-icon" href="<?php if(get_option('favicon')>""){
    echo get_option('favicon');
    }
    else
    {
    echo "http://thefunnyplanet.com/images/favicon.ico";
    }
    ?>">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
    
    
    
    
    <script>
    function sharenow(site)
    {
    var myurl,ourl;
    ourl="<?php echo nowpageurl(); ?>";
    if(site=='facebook')
    {
    myurl="http://www.facebook.com/share.php?u="+ourl;
    }
    if(site=='twitter')
    {
    myurl="http://twitter.com/home?status="+ourl;
    }
    if(site=='reddit')
    {
    myurl="http://www.reddit.com/submit?url"+ourl;
    }
    if(site=='pinterest')
    {
    myurl="http://pinterest.com/pin/create/bookmarklet/?is_video=false&url="+ourl;
    }
    if(site=='stumble')
    {
    myurl="http://www.stumbleupon.com/submit?url="+ourl;
    }
    window.open(myurl,"_blank","toolbar=no, location=yes, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=400, height=400");
    }
    </script>
    
    
    
    
    <link href="<?php echo get_template_directory_uri(); ?>/style.css" rel="stylesheet" type="text/css">
    
    
    <style>div.container{height:616px;}
    .container
    {
    height:auto !important;
    }
    
    
    </style>
    <style>
    <?php
    if(get_option('customcss')>"")
    {
    echo get_option('customcss');
    }
    
    
    
    
    
    
    ?>
    <?php 
    if(get_option('footerlinkedtxtcolor')>"")
    {
    echo "#footer a { color: ".get_option('footerlinkedtxtcolor')."!important; }";
    } 
    
    
    ?>
    
    
    <?php 
    if(get_option('bgurl')>"")
    {
    ?>
    html
    {
    background:url('<?php echo get_option('bgurl'); ?>');
    }
    <?php
    } 
    
    
    ?>
    </style>
    <title>
    <?php 
    global $wp_query;
    $template_name = get_post_meta( $wp_query->post->ID, '_wp_page_template', true );
    if($template_name=='order.php')
    {
    $orderby=$_GET['orderby'];
    if($orderby=='most-viewed')
    {
    $pagetitle="Most Viewed | ";
    }
    if($orderby=='top')
    {
    $pagetitle="Top Rated | ";
    }
    if($orderby=='recent')
    {
    $pagetitle="Most Recent | ";
    }
    if($orderby!='most-viewed' && $orderby!='top' && $orderby!='recent')
    {
    $pagetitle="All Recent | ";
    }
    echo $pagetitle;
    }
    
    
    
    
    ?>
    <?php
    	if(is_page() && !is_front_page() &&  $template_name!='order.php')
    {
    the_title();
    echo " | ";
    }
    
    
    if(is_single())
    {
    the_title();
    echo " | ";
    }
    
    
    if(is_category())
    {
    single_cat_title();
    echo " | ";
    bloginfo( 'name' );
    }
    else
    {
    bloginfo( 'name' );
    }
    
    
    	// Add the blog description for the home/front page.
    	$site_description = get_bloginfo( 'description', 'display' );
    	if ( $site_description && ( is_home() || is_front_page() ) )
    echo " | $site_description";
    
    
    
    
    	?>
    </title>
    <?php
    if(is_single())
    {
    echo "<meta property='og:image' content='".wp_get_attachment_url( get_post_thumbnail_id($post->ID) )."' /> ";
    }
    ?>
    <?php wp_enqueue_script( 'jquery' ) ?>
    <?php wp_head(); ?>
    
    
    <?php echo get_option('ganalytics'); ?>
    
    
    </head>
    
    
    
    
    <body>
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_GB/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    
    
    <div id="main">
    <div id="mid">
    <div id="header">
    <div class="content">
    <a title="Go to Home Page" id="logo" href="<?php echo site_url(); ?>"><img src="<?php if(get_option('logourl')>""){
    echo get_option('logourl');
    }
    else
    {
    echo "http://thefunnyplanet.com/images/logo2.png";
    }
    ?>
    "></a>
    <form name="search" id="searchbar" action="<?php echo site_url(); ?>" method="get">
    <input type="text" id="search1" name="s" placeholder="Search for Pix ;)" onclick="this.value='';'">
    <input type="submit" value="">
    </form>
    <div id="menu" style="float:right">
    <ul id="nav">
    <li><a href="<?php echo site_url(); ?>" title="Home Page">Home</a></li>
    <li><a href="<?php echo site_url(); ?>/order/?orderby=top">Top Rated</a>
    <div class="clear"></div>
    </li>
    <li><a href="<?php echo site_url(); ?>/order/?orderby=most-viewed">Most Viewed</a>
    <div class="clear"></div>
    </li>
    <li><a href="<?php echo site_url(); ?>/order/?orderby=recent">Recent</a>
    <div class="clear"></div>
    </li>
    <li><a href="">Categories</a>
    <ul style="display: none;">
    <?php wp_list_categories('title_li='); ?>
    </ul>
    <div class="clear"></div>
    </li>
    </ul>
    <div class="clear"></div>
    </div>
     
    <div class="clear"></div>
    </div>
    </div>  
    What the tabs look like now..
    pagetabs.jpg
     
    Last edited: Sep 2, 2013
  2. Endire

    Endire Elite Member Premium Member

    Joined:
    Mar 27, 2012
    Messages:
    1,756
    Likes Received:
    1,061
    Gender:
    Male
    Phobia2381,

    You would add another list element to the unordered list at the bottom of your code snippet. For example the menu is just an unordered list (<ul></ul>) with list elements in it (<li></li>). So the code snippet would look like this,

    Code:
    <li><a href="<?php echo site_url(); ?> /thc-meme-generator/"> thc meme generator</a>
    <div class="clear"></div>
    </li>
    Not sure why the empty div is in there but all menu items have it so you might as well keep it. You would add that code snippet among the following code.

    Code:
    <form name="search" id="searchbar" action="<?php echo site_url(); ?>" method="get">
    <input type="text" id="search1" name="s" placeholder="Search for Pix ;)" onclick="this.value='';'">
    <input type="submit" value="">
    </form>
    <div id="menu" style="float:right">
    <ul id="nav">
    <li><a href="<?php echo site_url(); ?>" title="Home Page">Home</a></li>
    <li><a href="<?php echo site_url(); ?>/order/?orderby=top">Top Rated</a>
    <div class="clear"></div>
    </li>
    <li><a href="<?php echo site_url(); ?>/order/?orderby=most-viewed">Most Viewed</a>
    <div class="clear"></div>
    </li>
    <li><a href="<?php echo site_url(); ?>/order/?orderby=recent">Recent</a>
    <div class="clear"></div>
    </li>
    <li><a href="">Categories</a>
    <ul style="display: none;">
    <?php wp_list_categories('title_li='); ?>
    </ul>
    <div class="clear"></div>
    </li>
    </ul>
    <div class="clear"></div>
    </div>
     
    <div class="clear"></div>
    </div>
    </div>
    It doesn't matter where you put it among the code (as long as the snippet is separate from other opened and closed tags). Where you put it will determine where it appears in the menu. If you just want it to be the last menu item, put it between the </li> and </ul> tag at the end of the snippet above.

    Hope that helps,

    Shawn
     
    • Thanks Thanks x 1
  3. phobia2381

    phobia2381 Junior Member

    Joined:
    Nov 3, 2012
    Messages:
    180
    Likes Received:
    263
    Location:
    Error 404! The Freedom you were looking for could
  4. Endire

    Endire Elite Member Premium Member

    Joined:
    Mar 27, 2012
    Messages:
    1,756
    Likes Received:
    1,061
    Gender:
    Male
    Glad it at least half worked for you. Perhaps try removing the php part and see if that works.

    Specifically

    <?php echo site_url(); ?>
     
    • Thanks Thanks x 1
  5. phobia2381

    phobia2381 Junior Member

    Joined:
    Nov 3, 2012
    Messages:
    180
    Likes Received:
    263
    Location:
    Error 404! The Freedom you were looking for could
    It worked thanks again man, I can now carry on lol.. Best regards