WordPress.org

Ready to get started?Download WordPress

Forums

Simplify
[resolved] Make Featured Box images Links to Pages (11 posts)

  1. MoeyBell
    Member
    Posted 1 year ago #

    Thanks you for creating such a lovely template. It suits my site perfectly (Makeup Artist)

    Can you please tell me how I can make the 3 images of the featured box to be links to pages within my website? (Its not live yet so I can't share a link)

  2. MoeyBell
    Member
    Posted 1 year ago #

    I worked it out. Within the featured-box.php I copied the code 3 times, changing the top text of each one to:

    $fboxclm = array("1");
    $fboxclm = array("2");
    $fboxclm = array("3");

    then added the link to each box instead of the #

    <a href="<?php echo of_get_option('featured-link'. $fboxn, ' LINK'); ?>">

    I hope this helps others.

  3. MeXxX
    Member
    Posted 1 year ago #

    Hello, i´ve got the same problem.
    I´m not really good at php...
    How should the code look like?

    <?php
    $fboxclm = array("1","2","3");
    foreach ($fboxclm as $fboxn) { ?>
    <span class="featured-box">
    ">

  4. MeXxX
    Member
    Posted 1 year ago #

    Okay, man muss von
    <?php } ?>

    bis

    </span>

    kopieren, nummerieren und dann die Links eintragen

  5. Barry Livingstone
    Member
    Posted 1 year ago #

    I was able to get it to work a little differently. The pages I wanted to link to happened to be indexed 1, 2, and 3 so I simply was able to add my link text to the loop and exit out of the quote - . add / append to the index variable and kaboom! all three links worked.

    PSYCHED!

  6. WPYoda
    Member
    Posted 1 year ago #

    You need to do this:

    <?php
    		$fboxclm = array("1");
    		foreach ($fboxclm as $fboxn) { ?>
    
    		<span class="featured-box">
    			<a href="<?php bloginfo('url'); ?>/your_url/" title="<?php echo of_get_option('featured-title' . $fboxn , ''); ?>">
    				<img class="box-image" src="<?php echo of_get_option('featured-image' . $fboxn, get_template_directory_uri() . '/images/featured-image' . $fboxn . '.jpg') ?>"/>
    				<h3><?php echo of_get_option('featured-title' . $fboxn , ''); ?></h3>
    			</a>
    			<div class="content-ver-sep"></div>
    			<br />
    			<p><?php echo of_get_option('featured-description' . $fboxn , ''); ?></p>
    		</span>
    
    	<?php } ?>
    	<?php
    		$fboxclm = array("2");
    		foreach ($fboxclm as $fboxn) { ?>
    
    		<span class="featured-box">
    			<a href="<?php bloginfo('url'); ?>/your_url/" title="<?php echo of_get_option('featured-title' . $fboxn , ''); ?>">
    				<img class="box-image" src="<?php echo of_get_option('featured-image' . $fboxn, get_template_directory_uri() . '/images/featured-image' . $fboxn . '.jpg') ?>"/>
    				<h3><?php echo of_get_option('featured-title' . $fboxn , ''); ?></h3>
    			</a>
    			<div class="content-ver-sep"></div>
    			<br />
    			<p><?php echo of_get_option('featured-description' . $fboxn , ''); ?></p>
    		</span>
    
    	<?php } ?>
    	<?php
    		$fboxclm = array("3");
    		foreach ($fboxclm as $fboxn) { ?>
    
    		<span class="featured-box">
    			<a href="<?php bloginfo('url'); ?>/your_url/" title="<?php echo of_get_option('featured-title' . $fboxn , ''); ?>">
    				<img class="box-image" src="<?php echo of_get_option('featured-image' . $fboxn, get_template_directory_uri() . '/images/featured-image' . $fboxn . '.jpg') ?>"/>
    				<h3><?php echo of_get_option('featured-title' . $fboxn , ''); ?></h3>
    			</a>
    			<div class="content-ver-sep"></div>
    			<br />
    			<p><?php echo of_get_option('featured-description' . $fboxn , ''); ?></p>
    		</span>
    
    	<?php } ?>

    The header of the file goes unchanged.

  7. theopears
    Member
    Posted 1 year ago #

    Hi there,
    the first comment was very helpful. I added LINK and it allowed me to go elsewhere. How to I actually connect that to one of my pages though? As of now all it says is "Page not found".
    Thanks!

  8. Web Aesthetics
    Member
    Posted 1 year ago #

    Thanks very helpful. Copied the last block of php code three times and changed the links and numbers. Works great.

  9. trixielms
    Member
    Posted 1 year ago #

    Thanks BugsUsNot! I used your script and altered a little so that it still had the recent works title and standardized the height for the boxes. I was a little at a loss but this worked perfectly.

  10. amecwi
    Member
    Posted 1 year ago #

    I am brand new to WP and have little experience with CSS or PHP. I am trying to link the images on my website using the response from WPYoda, but I am still struggling to get it to work.

    I am not sure if this can just be entered into Edit CSS, or do you have to make the changes in featured-box.php?

    I am also confused on where you put the link you want it to redirect. I have tried it multiple times and just can't get it to work.

    My site is active and I have the pages already created that I want to redirect from the featured image, so if anyone could help I would be forever thankful.

    Here is what I am trying to accomplish:

    Image 1: Redirect to http://www.benwitt.com/mortgagecenter/conventional-5-down-wo-mi/

    Image 2 & 3: Redirect to
    http://www.benwitt.com/mortgagecenter/

    Thank you!

  11. AbbieOz1
    Member
    Posted 11 months ago #

    amecwi - I am having the same problem - have you found a solution yet?

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic