Viewing 26 posts - 1 through 26 (of 26 total)
  • Author
    Posts
  • #204

    Kriesi,

    Thanks again for the great theme, I’m having great success with it so far.

    I’m wondering if it would be possible to remove the Read More buttons that appear in the Mainpage Columns. I am using small text posts which format great for me but I just want to remove that Read More button in that specific place.

    Also, I’m wondering if it would be possible to use one part of the portfolio system but not the other. I really like the preview page with the columns, but I would rather these Read More buttons to link to specific pages that I have set up for each item. Is it possible to have the Read More button link to a page rather than to the Portfolio Item itself?

    Thanks again!

    AC

    #30305

    Hey!

    you can remove the read more buttons on the home page by opening the folder framework/classes/kclass_display_box.php and scroll down to the bottom to line 123.

    remove


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

    if you want the portfolio item link to a page you need to do the following:

    Open up /theme_options/portfolio.php and find this code:


    'supports' => array('title','thumbnail','excerpt','editor','comments')

    change it to:


    'supports' => array('title','thumbnail','excerpt','editor','comments', 'custom-fields')

    now you got the ability to use custom fields in your portfolio items.

    so whenever you create a new portfolio entry now scroll down to the custom field area and create a new one that is called “link”. The value should be the url that the item should point to.

    now open template_porfolio.php and at line 73 add this:


    $the_link= get_post_meta($post->ID, "link", true);

    This will store the url into the $link variable.

    now search for get_permalink() in line 130 and replace it with $link

    #30306

    Thanks for the speedy help! The first part worked magic, the Read More buttons are gone. When I implement the code for the Portfolio pages, the formatting for the Read More button doesn’t show up (it’s just text) and the link when I hover my cursor over is this:

    http://www.domain.com/class='more-link

    I added the first part to line 73 and then changed get_permalink() to $link. I also have a custom field called link and have the URL desired as the value.

    Any thoughts?

    #30307

    Hey again,

    I realize the formatting error was on my part, I fixed the quotation marks in the code and the formatting of the Read More buttons came back. I think I have all the settings right now, but when you hover over the Read More buttons, it just gives a link to my home page and not to the page supplied in the custom field in the portfolio item.

    #30308

    Hi!

    $link should be $the_link

    You also need to add a custom field called “link” with the URL of the page you want the button to link to.

    Best regards,

    James

    #30309

    Thanks again for your support.

    I have tried different combinations trying to solve the issue and it’s still not working. Here’s the current formating for my line 130 in template_portfolio.php

    echo "<a href='$the_link' class='more-link'>".__('Read more','cleancut')."</a>";

    Is this correct? When I have it in this format, the link that shows up in the Read More buttons is now my portfolio page instead of just my home page, but the custom field still doesn’t appear to be working. Do I need the quotations around it, “link”, for it to work (I’ve tried both and neither seem to affect it).

    Thank you again!

    AC

    #30310

    The code you posted has a mistake and should look like this:

    echo "<a href='".$the_link."' class='more-link'>".__('Read more','cleancut')."</a>";

    Can you post a link to your Portfolio page?

    I assume you’ve added a custom field called “link” with the value of the URL you want to point the page to like this:

    #30311

    I have altered my line 130 to match the above, and yes, I have a custom field set up just like you have outlined above, and still the link on the Read More buttons is just a link to the portfolio page, and not to the supplied page in the custom field.

    My portfolio page is found at http://www.nlchoral.ca/choirs

    AC

    #30312

    Hey!

    The href attribute is missing from the links. Can you upload a copy of your template_portfolio.php file here: http://pastebin.com/ so I can see what’s going on?

    Best regards,

    James

    #30313

    http://pastebin.com/arGxqeFZ

    Thanks again guys, I REALLY appreciate your efforts!!

    AC

    #30314

    The code I posted above has the ” and ‘ ‘s the wrong way around. Sorry, it difficult to spot it because they look very similar and are next to each other. Change line 130 to this:

    echo "<a href="'.$the_link.'" class='more-link'>".__('Read more','cleancut')."</a>";

    and your problem should be solved.

    #30315

    I’m really sorry to keep bothering over what I’m sure is a small issue, but I have very little coding experience so your advice is VERY well appreciated!

    I have changed line 130 to what you have above, but now my portfolio page is giving me the following error:

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ‘,’ or ‘;’ in /home/***/public_html/wp-content/themes/cleancut/template_portfolio.php on line 130

    AC

    #30316

    Try this code:

    echo '<a href="'. $the_link. '" class="more-link">'.__('Read more','cleancut').'</a>';

    #30317

    Dude,

    The above code just gives me the above problem, when you look at the source for the page, the href tag is missing and the Read More buttons just link to the actual portfolio page and not to the link supplied in the custom field. Thanks though! Any other ideas?

    AC

    #30319

    Dude,

    When I implement your code above, I get the resulting source code for the page.

    http://pastebin.com/QDW7UJHJ

    #30320

    Maybe there’s a problem with these “” in the code.

    Try to write $the_link = get_post_meta($post->ID, 'link', true)

    instead of

    $the_link = get_post_meta($post->ID, "link", true)

    #30321

    Changing the marks around ‘link’ (“link” or ‘link’) doesn’t appear to have any effect.

    #30322

    Ok then we need to find the problem step by step.

    Try to give $the_link a static value. So i.e. don’t write:

    $the_link = get_post_meta($post->ID, 'link', true);

    but something like :

    $the_link = 'http://google.com';

    By trying this we’ll find out if our echo code is the problem or if the post_meta value is missing. At the moment it looks like $the_link is always an empty string and so where always getting an “empty” a href link.

    We’ll see but I think that the post_meta_value is the problem. Maybe we should define the $the_link variable globally, so before if and while loops change it.

    The Dude

    #30323

    I think you’re right, changing the above does indeed change the link of the buttons to Google, so maybe it’s another issue.

    #30324

    I really don’t know enough about coding but does it matter that it’s a page and not a post? I’m trying to link to a WordPress PAGE so does that require different code?

    #30325

    No that shouldn’t be a problem. I use get_post_meta on my site to change the background images of posts AND pages. And according to: http://codex.wordpress.org/Function_Reference/get_post_meta it shouldn’t make a difference. The reason why there’s “only” a post meta is that WordPress has it’s origins in the blogging community. So only one site with articles (posts).

    The Dude

    #30326

    @andrewc: The last code I posted:

    echo "<a href='".$the_link."' class='more-link'>".__('Read more','cleancut')."</a>";

    is correct. Can you email a copy of the template_portfolio.php file to support {at} jamesmorrisondesign {dot} com with the subject:

    Kriesi | Cleancut | andrewc | Read More and Portfolio Links

    and I’ll look through the code.

    #30327

    James,

    I e-mailed the file as requested, thanks again.

    AC

    #30328

    Edit: There’s a problem with the post_meta only. The Echo syntax is correct.

    The Dude

    #30329

    PERFECT! Thanks again James, you guys are AMAZING!

    Cheers,

    AC

    #30330

    Just for everyone else’s benefit, the code was correct but the:

    $the_link = get_post_meta($post->ID, 'link', true);

    code needed to be place directly above this code:

    echo "<a href='".$the_link."' class='more-link'>".__('Read more','cleancut')."</a>";

    I’m closing this topic, if anyone needs help related to this please open a new topic and link to this one.

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

The topic ‘Read More and Portfolio Links’ is closed to new replies.