Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Custom Field or…

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #34241
    Faberuna
    Member

    OK, here’s what I’d like to do: I’d like it if a visitor to http://www.faberunashop.com/ had the ability to click on one of the homepage images and be directed to another site, the site of the featured vendor, versus going into a post. Is that done in the custom field or is that a CSS adjustment?

    #86549
    TheDoc
    Member

    You could definitely do it via a custom field.

    #86550
    Faberuna
    Member

    So, the question is: what do I put in the custom field.

    #86553
    TheDoc
    Member

    Depends on how your home page is set up. Presumably you would simply put in the URL you are wanting to redirect to. Then, in your home.php or front-page.php template you will replace the_permalink with your custom field.

    #86555
    Faberuna
    Member

    ok. I will give it a try.

    #86556
    Faberuna
    Member

    When I do the custom field, do I use a href=”http://www.debreardonsart.com/” or just http://www.debreardonsart.com for instance?

    #86557
    Faberuna
    Member

    So, I altered the functions.php & the index.php so that if you click on the post title you get to an external link. How do I do it to the rollover image?

    #86558
    Faberuna
    Member

    Here’s the code I used:

    function print_post_title() {
    global $post;
    $thePostID = $post->ID;
    $post_id = get_post($thePostID);
    $title = $post_id->post_title;
    $perm = get_permalink($post_id);
    $post_keys = array(); $post_val = array();
    $post_keys = get_post_custom_keys($thePostID);

    if (!empty($post_keys)) {
    foreach ($post_keys as $pkey) {
    if ($pkey=='url1' || $pkey=='title_url' || $pkey=='url_title') {
    $post_val = get_post_custom_values($pkey);
    }
    }
    if (empty($post_val)) {
    $link = $perm;
    } else {
    $link = $post_val[0];
    }
    } else {
    $link = $perm;
    }
    echo '

    '.$title.'

    ';
    }

    Then:

    Once that’s done, open your index.php file and replace the standard code for printing titles…

    " rel="bookmark" title="Permanent Link to ">

    … with a call to our newly created print_post_title() function:

    Now, whenever you feel like pointing one of your posts’ titles somewhere other than your own blog, just scroll down in your post editor and create or select a custom key called url1 or title_url or url_title and put the external URL in the value box.

    #86559
    TheDoc
    Member

    I’m not really sure what theme you are using or what’s happening here.

    All I would have done was created a custom field, and then changed where ever it’s calling the_permalink with it.

    #86560
    Faberuna
    Member

    I’m a little dense so I don’t really know how to do that. The theme is this one: http://wpshower.com/themes/imbalance/

    #86561
    TheDoc
    Member

    Ah – okay. So if you post the code for whatever is creating your home page (whether it be index.php, home.php or front-page.php) I’ll be able to help you from there!

    #86562
    Faberuna
    Member

    Thanks! Here is the home.php







    • if ( has_post_thumbnail() ) { ?>
      $imgsrcparam = array(
      'alt' => trim(strip_tags( $post->post_excerpt )),
      'title' => trim(strip_tags( $post->post_title )),
      );
      $thumbID = get_the_post_thumbnail( $post->ID, 'background', $imgsrcparam ); ?>




























    #86602
    TheDoc
    Member

    Perfect. So I would change this:

    to this:

    Then create a custom field called ‘url’ and put in the website.

    #86606
    Faberuna
    Member

    Thanks for your help. I will try and get back to you.

    #86607
    Faberuna
    Member

    Perfect! Thanks!

Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘CSS’ is closed to new topics and replies.