Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #3448

    Can each ‘read more’ link in the portfolio page direct to an individual page instead of a post?

    #42281

    Hey,

    open up displayframeworkclasseskclass_display_box.php and replace following code:

    echo '<a href="'.get_permalink().'" class="more-link">Read more</a>';

    with:

    <?php
    if (get_post_meta($post->ID, 'url', true)){
    echo '<a href="'.get_post_meta($post->ID, 'url', true).'" class="more-link">Read more</a>';
    }else{
    echo '<a href="'.get_permalink().'" class="more-link">Read more</a>';
    }
    ?>

    Afterwards you can set post meta fields in all your posts/pages which should appear in your mainpage columns (pages/posts you set under Display Options > Mainpage Options). Call the fields “url” and type in the websites’ adresses as values. This post will tell you more about custom fields: http://www.kriesi.at/archives/how-to-use-wordpress-custom-fields

    #42282

    Hi,

    Ok – so I’ve replaced the code. Then what do I need to do? I need you to explain it like your talking to a 10 year old I’m afraid. Please walk me through setting the ‘post meta fields’. I looked at the link and couldn’t make any sense of it.

    Thanks for your patience.

    Tim

    #42283

    Hey,

    you can find the custom fields under the text area in your post/page editor page. You’ss see two input fields (one left and one right. Screenshot:

    Now in the left field type “url” and in the right field type the url adress to the page you want to link to i.e. http://google.com

    Afterwards click on “Add custom field”

    #42284

    I’m looking to apply the same thought to the main page “read more”. What code would I apply to get the “read more” on the main page to link to a page? Thanks in advance.

    #42285

    Yes,

    however instead of modifying template_portfolio.php you’ll need to modify /framework/classes/kclass_display_box.php

    Open it up and replace:

    echo '<a href="'.get_permalink().'" class="more-link">Read more</a>';

    with:

    if (get_post_meta($post->ID, 'url', true)){
    echo '<a href="'.get_post_meta($post->ID, 'url', true).'" class="more-link">Read more</a>';
    }else{
    echo '<a href="'.get_permalink().'" class="more-link">Read more</a>';
    }

    #42286

    thxs for the response. One more quick thing – I’m having trouble tracking down the kclass_display_box.php file via the path in your last post. In fact I looked everywhere in my directory and couldn’t track it down? Any suggestions? Is it an add-on file?

    #42287

    G to wp-content/themes directory. Then go to Display > framework > classes folder. There you’ll find kclass_display_box.php

    #42288

    I followed the path and still no directory with Display > framework > classes folder. There you’ll find kclass_display_box.php

    Just to confirm I’m working with the Twicet theme.

    #42289

    I just noticed that you have a theme called display. When I searched this topic I thought it was with the Twicet theme’s topics? Sorry for the mix up. Should I repost my question with-in the Twicet for organizational purposes? I’m basically trying to get the read more buttton on the main page slider to link to a page rather than the post. Is this possible with in the Twicet theme?

    #42290

    Hey,

    for twicet open up index.php and replace:

    the_content('read more »');

    with:

    the_content('');
    if (get_post_meta($post->ID, 'url', true)){
    echo '<a href="'.get_post_meta($post->ID, 'url', true).'" class="more-link">Read more</a>';
    }else{
    echo '<a href="'.get_permalink().'" class="more-link">Read more</a>';
    }

    You can search a certain forum by using the advanced search here: http://www.kriesi.at/support/search.php?q= – click on “advanced search” and you can select the forum you want to use for your search.

    #42291

    thank you!

    #42292

    Glad that I could help you :)

Viewing 13 posts - 1 through 13 (of 13 total)

The topic ‘Can the 'read more' link direct to a page instead of a post?’ is closed to new replies.