Can each 'read more' link in the portfolio page direct to an individual page instead of a post?
Can the 'read more' link direct to a page instead of a post?
13 posts from 3 voices-
Posted 2 years ago #
-
Hey,
open up display\framework\classes\kclass_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
Posted 2 years ago # -
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
Posted 2 years ago # -
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"
Posted 2 years ago # -
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.
Posted 2 years ago # -
Yes,
however instead of modifying template_portfolio.php you'll need to modify /framework/classes/kclass_display_box.phpOpen 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>'; }Posted 2 years ago # -
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?
Posted 2 years ago # -
G to wp-content/themes directory. Then go to Display > framework > classes folder. There you'll find kclass_display_box.php
Posted 2 years ago # -
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.
Posted 2 years ago # -
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?
Posted 2 years ago # -
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.
Posted 2 years ago # -
thank you!
Posted 2 years ago # -
Glad that I could help you :)
Posted 2 years ago #
Reply
You must log in to post.














