I have a technical question about modifying a template in the Studio Theme

Hello,

I want to modify the theme template structure for the “link url” (defined in the Header Section theme options) so that the “link url” will be dynamically generated and also open in a new window.

Does anybody know the location where the url link is actually being rendered for the front page button?

Details:

Currently the theme allows me to define the usual link in the admin area on the theme options page.

But if I add some bit of code to the url definition, the code segment is generated as “text” and is not actually processed. Example <?php echo $var ?> is rendered literally rather than delivering the variable value.

My guess is that I need to add the <?php echo $var ?> code segment to the template so that is will be generated as part of the url for the button.

I found the option-function. php file that creates the Theme Options Page – but I am having trouble finding the code where the url link is actually being rendered.

Can anybody point me in the right direction?

Thanks Much,

Michael

  • rozani
    • Site Builder, Child of Zeus

    Hi twicealive,

    I really don’t understand what $var that you want.

    For the link to be open in a new window, you need to add TARGET=”_blank” in your link just like example below:

    <A HREF="http://www.yourdomain.com" TARGET="_blank">Your Text</a>

  • twicealive
    • The Incredible Code Injector

    Hi Rozanighani

    Thanks for your reply!

    I’m looking inside the Studio Theme templates for the place that generates that specific link for the front page header button.

    I know about the field in the “Theme options” control panel where I can add the url for the button, but I want to actually modify the theme so it will add this ?e=<?php echo $var ?> piece of code at the end of the url.

    Thanks for any help,

    Michael

  • Tammie
    • WordPress Wizard

    Options strip html out like that for security reasons so you’d be adding it as a hard coded link to the file. In this case as it’s not very clear which link url you are on about I can suggest a starting point of header.php.

    I’d advise using the child theme and copying the entire header.php into there and then doing your edits.

  • twicealive
    • The Incredible Code Injector

    Thanks Tammie, for your kind reply, I appreciate it.

    I'll keep looking for the location of the url link – I attached a couple of images to show the link I'm looking for. If anyone knows the location the code where the url link is actually being rendered (in the Studio Theme) it would be helpful if you would point it out to me.

    Thanks Much,

    Michael

  • Tammie
    • WordPress Wizard

    In studio all the content output files ie; the ones that pull in entered content from theme options are stored under library/components. This file is strapline.php (this files gets called). In the home.php you can see the calls to this along with header.php.

    Here is what we have in strapline.php (*you could remove the strip slashes BUT it’s a security risk to do so). We’d also suggest any change should be done in the child theme.

    <?php
    $headeron = get_option('dev_studio_header_show');
    $headertitle = get_option('dev_studio_header_title');
    $headerlink = get_option('dev_studio_header_link');
    $headerurl = get_option('dev_studio_header_url');
    $headeralt = get_option('dev_studio_header_alt');
    $headerdescription = get_option('dev_studio_header_description');

    if (($headeron == "yes") || ($headeron == "")){
    /* function to check blanks */
    if ($headertitle == ""){
    $headertitle = "Set this page up in theme options";
    }
    if ($headerlink == ""){
    $headerlink = "Add your link";
    }
    if ($headerdescription == ""){
    $headerdescription = "Simply log into your admin panel then go to apperance > theme options and set up all your site settings.";
    }
    ?>
    <!-- start site wide call to action section -->
    <div id="strapline-wrapper"><!-- start #strapline-wrapper -->
    <div id="strapline-holder"><!-- start #strapline-holder -->
    <div id="strapline"><!-- start #strapline -->
    <h1>
    <?php echo stripslashes($headertitle); ?>
    </h1>
    <a href="<?php echo $headerurl; ?>" title="<?php echo stripslashes($headeralt); ?>" class="button alignright"><?php echo stripslashes($headerlink); ?></a>
    <h2><?php echo stripslashes($headerdescription); ?></h2>
    <div class="clear"></div>
    </div><!-- end #strapline -->
    </div><!-- end #strapline-holder -->
    </div><!-- end #strapline-wrapper -->
    <!-- end call to action section -->
    <?php } ?>

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.