-
Author
Tagged: portfolio link
-
April 16, 2015 at 17:01 #54829akalParticipant
Hi,
I continue to move forward on my website project with the KLEO template and it’s a pleasure to work on it.
Like I’ve asked to other theme editors (gt3, goodlayer) which were kind enought to develop it, I need a field in the portfolio editor that allow to change the url of the portfolio to a specific link.
Maybe this function already exists and I have missed it ? If not, can you please provide a short piece of code that I would be able to integrate in the KLEO child ? That would be really kind 😀Best Regards
Akal
Attachments:
You must be logged in to view attached files.April 20, 2015 at 05:39 #55184AndreiModeratorCan you please post a bigger screenshot with the place where you want this to be implemented because I can’t manage to figure where this field should be located.
Looking forward.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 20, 2015 at 16:22 #55261akalParticipantHi,
thank for your reply. This should be implemented in “Edit Portfolio item” (view screenshot).
Below it is what I’ve implemented for another WP theme.
I’m not good enought to change this code to fit with KLEO but if you are ok with that, maybe you could do the adaptation for me ?<u>Admin Portfolio Edition : (portfolio-masonry.php I guess ?)</u>
“Portfolio Custom Link” => array(
‘title’=> __(‘Portfolio Link’, ‘xxx-theme-name’),
‘name’=>’portfolio-custom-link’,
‘type’=>’inputtext’,
‘description’=>’This will change the url of the portfolio to a specified link’
),<u>Portfolio item : (single-portfolio.php I guess ?)</u>
$custom_permalink = get_post_meta(get_the_ID(), ‘portfolio-custom-link’, true);
if(!empty($custom_permalink)){
echo ‘‘ . get_the_title() . ‘‘;
}else{
echo ‘‘ . get_the_title() . ‘‘;
}Hope It’s clear enought ^^
CheersAkal
Attachments:
You must be logged in to view attached files.April 20, 2015 at 16:56 #55265AndreiModeratorWhy would you need to add a separate field and build custom functionality for this, when you can edit the permalink by default directly from wordpress, by pressing the edit button below the title field.
http://seventhqueen.com/public-files/andrei_2015-04-20_16-50-57.png
Let me know if there is any difference from this feature and what you’re trying to achieve.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionApril 20, 2015 at 17:07 #55266akalParticipantThis is not about permalink, this is about associate a custom link (like a wordpress Page) to the portfolio
Example : http://dev16.digitalis-web.fr/
if you clic on one of the first 8 items, you naturaly go to the portfolio related page.
Example : if you clic on “Fitness Musculation Paris…” you’ll go to http://dev16.digitalis-web.fr/portfolio/fitness/
What I’m looking for is to be able to send you to another page or post or external link, what ever. For my example I want to send people here => http://dev16.digitalis-web.fr/activites-sport-et-loisirs/fitness-musculation/
I could do that with the 301 redirection function of Yoast SEO Plugin, but it’s a redirection and I’m looking for a native link.April 20, 2015 at 18:02 #55271AndreiModeratorI see, then please try to use the following functionm which should be added to your active theme, in the functions.php file, and it should be used in combination with the redirect field provided by the Yoast Seo plugin. It should change your link directly from the listing without any template modifications. Please note that links will be changed in the whole site.
COPY CODEfunction kleo_portfolio_permalink_using_yoast_redirect( $url, $post, $leavename ) { if ( $post->post_type == 'portfolio' ) { $yoast_redirect = get_post_meta($post->ID, '_yoast_wpseo_redirect', true); if($yoast_redirect){ return $yoast_redirect; } } return $url; } add_filter( 'post_type_link', 'kleo_portfolio_permalink_using_yoast_redirect', 10, 3 );
Let me know if it worked.
CheersHi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘KLEO’ is closed to new topics and replies.