SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    changing link of the button

    hi
    i made a website in wordpress and i changed the template. there is two buttons in home page that says "download" and "view demo" and they both go to home page. i changed the images but i don't know how to change the links since i don't really know css. in the index file of the template there is two codes for buttons:
    Code:
    <div class="buttons">
                            <a href="<?php echo get_option('Ndegree_dlink'); ?>"><img class="" src="<?php bloginfo('template_url'); ?>/images/download.png" title="Click to download" alt="Download"/></a>
                            <a href="<?php echo get_option('Ndegree_demolink'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/view-demo.png" title="Click to view demo" alt="View Demo"/></a>
                        </div>
    and there is a functions file that has a related code:
    Code:
    <td>Download Button Link:</td>
    			<td><input type="text" name="Ndegree_dlink" id="Ndegree_dlink" size="50" value="<?php echo get_option('Ndegree_dlink'); ?>" />
    		</td>
    		</tr>
    		<tr>
    		<td>Demo Button Link:</td>
    			<td><input type="text" name="Ndegree_demolink" id="Ndegree_demolink" size="50" value="<?php echo get_option('Ndegree_demolink'); ?>" />
    		</td>
    i know i need to somehow change the "ndegree_dlink" and "ndegree_demolink". but i don't really know how.
    i replaced them with the url i wanted but they still go to home page. if you can tell me how to change one of them it would be enough.
    and excuse my bad english.
    tanks in advance

  2. #2
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Hi,

    Just to understand your problem correctly:
    You have two buttons "download" and "view demo".
    Currently when you click them they go to the home page.
    However, you want them to go somewhere else when they're clicked.

    Is that correct?

    I'm sure we'll be able to sort this out.

  3. #3
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes. that's correct

  4. #4
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    The location to which the link goes when it is clicked is specified by the href attribute of the anchor tag.
    In the above code this attribute is generated by a call to the function "get_option('Ndegree_dlink')" or "get_option('Ndegree_demolink')".
    You can either find where this function is defined (in functions.php, maybe?) and change its return value, or you can change it by hand.
    E.g.
    HTML Code:
    <a href="http://mysite.com/whatever"><img class="" src="<?php bloginfo('template_url'); ?>/images/download.png" title="Click to download" alt="Download"/></a>
    If you do it this way, you can use either the complete path (as in the example), the path from the server root (/download) or a relative path (../download)

  5. #5
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    By the way, it might be better to change the return value of the function if you use it in more than one place.

  6. #6
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    tank you pullo, it worked perfectly.
    as i said in the first post, in the functions.php there is 2 codes that seems related to it (second code in first post). but i couldn't find any return value to change.
    i use them only in home page so i changed it manually and it worked.
    you are the best

  7. #7
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,941
    Mentioned
    215 Post(s)
    Tagged
    12 Thread(s)
    Happy to help


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •