-
AuthorPosts
-
November 27, 2014 at 5:25 pm #359082
Can you advise on how to set up website so I have the following url structures for portfolio item and blog entries?
mydonain.com/blog/news-item/
mydomain.com/portfolio/portfolio-item/
I have yoast seo installed, but unable to change the url structure of both news and portfolio items at the same time. I eaither end up with:
mydonain.com/blog/news-item/ and mydomain.com/news/portfolio/portfolio-item/
or
mydonain.com/news-item/ and mydomain.com/news/portfolio/portfolio-item/
Can you advise?
Kind regards
Duncan
November 28, 2014 at 6:34 am #359404Hey dweddell!
Thank you for using Enfold.
Try this structure on Settings > Permalink > Custom Structure field:
/blog/%postname%
Change the portfolio item url on the Portfolio Items Base field.
Regards,
IsmaelDecember 9, 2014 at 10:20 pm #365669Hello,
I am using this structure as my permalink. However, I would like /blog/ to be excluded from my portfolio item URL. Is there any change to the code that can be done to solve the problem I am facing:
Blog post: http://www.optimusinfo.com/blog/optimus-information-breakfast-series-mobile-development-outsourcing/
Portfolio item (Current): http://www.optimusinfo.com/blog/case-study/test-scenarios-for-credit-card-payment-through-a-pos-application/
Portfolio item (Requested): http://www.optimusinfo.com/case-study/test-scenarios-for-credit-card-payment-through-a-pos-application/
Thanks,
JasonDecember 10, 2014 at 3:31 am #365808Hey!
I tested this on my installation and it is really a problem when it comes to portfolio items. Not sure how we can amend this. I’ll ask the rest of the support team if they have any idea.
Regards,
IsmaelDecember 12, 2014 at 12:28 am #367057Hi!
Try opening up /enfold/includes/admin/register-portfolio.php and change line 34 from this.
'rewrite' => array('slug'=>_x($permalinks['portfolio_permalink_base'],'URL slug','avia_framework'), 'with_front'=>true),
To this.
'rewrite' => array('slug'=>_x($permalinks['portfolio_permalink_base'],'URL slug','avia_framework'), 'with_front'=>false),
Cheers!
ElliottDecember 12, 2014 at 2:23 am #367097Thanks, but that did not work. It removed /blog/ from the portfolio item URL in the portfolio. However, when I clicked to view the item it took me to http://www.optimusinfo.com/case-study/test-scenarios-for-credit-card-payment-through-a-pos-application/ and displayed a 404 error. The URL of the individual portfolio items did not change. They were still: http://www.optimusinfo.com/blog/case-study/test-scenarios-for-credit-card-payment-through-a-pos-application/
Any idea how to change the URL of the portfolio items as well?
Thanks
JasonDecember 12, 2014 at 7:06 pm #367426Hi!
Sorry, I forgot to tell you to refresh your permalinks in Dashboard > Settings > Permalinks after doing the edit.
Cheers!
Elliott- This reply was modified 9 years, 11 months ago by Elliott.
December 13, 2014 at 12:09 am #367561Fantastic, that worked!
I am worried I will lose this change whenever I update the theme. Can this be added to a child theme? If so, is there an Enfold child theme that I can install and apply the change there. If so, please share instructions.
Thanks again
December 13, 2014 at 1:05 am #367581Hey!
See here for downloading our Enfold child theme, http://kriesi.at/documentation/enfold/downloads/.
Add this to the bottom of your child theme functions.php file.
add_action('init', 'portfolio_register_extended', 999 ); function portfolio_register_extended() { global $avia_config; $labels = array( 'name' => _x('Portfolio Items', 'post type general name','avia_framework'), 'singular_name' => _x('Portfolio Entry', 'post type singular name','avia_framework'), 'add_new' => _x('Add New', 'portfolio','avia_framework'), 'add_new_item' => __('Add New Portfolio Entry','avia_framework'), 'edit_item' => __('Edit Portfolio Entry','avia_framework'), 'new_item' => __('New Portfolio Entry','avia_framework'), 'view_item' => __('View Portfolio Entry','avia_framework'), 'search_items' => __('Search Portfolio Entries','avia_framework'), 'not_found' => __('No Portfolio Entries found','avia_framework'), 'not_found_in_trash' => __('No Portfolio Entries found in Trash','avia_framework'), 'parent_item_colon' => '' ); $permalinks = get_option('avia_permalink_settings'); if(!$permalinks) $permalinks = array(); $permalinks['portfolio_permalink_base'] = empty($permalinks['portfolio_permalink_base']) ? __('portfolio-item', 'avia_framework') : $permalinks['portfolio_permalink_base']; $permalinks['portfolio_entries_taxonomy_base'] = empty($permalinks['portfolio_entries_taxonomy_base']) ? __('portfolio_entries', 'avia_framework') : $permalinks['portfolio_entries_taxonomy_base']; $args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug'=>_x($permalinks['portfolio_permalink_base'],'URL slug','avia_framework'), 'with_front'=>false), 'query_var' => true, 'show_in_nav_menus'=> true, 'taxonomies' => array('post_tag'), 'supports' => array('title','thumbnail','excerpt','editor','comments') ); $args = apply_filters('avf_portfolio_cpt_args', $args); $avia_config['custom_post']['portfolio']['args'] = $args; register_post_type( 'portfolio' , $args ); $tax_args = array( "hierarchical" => true, "label" => "Portfolio Categories", "singular_label" => "Portfolio Category", "rewrite" => array('slug'=>_x($permalinks['portfolio_entries_taxonomy_base'],'URL slug','avia_framework'), 'with_front'=>true), "query_var" => true ); $avia_config['custom_taxonomy']['portfolio']['portfolio_entries']['args'] = $tax_args; register_taxonomy("portfolio_entries", array("portfolio"), $tax_args); //deactivate the avia_flush_rewrites() function - not required because we rely on the default wordpress permalink settings remove_action('wp_loaded', 'avia_flush_rewrites'); }
Regards,
Elliott- This reply was modified 9 years, 11 months ago by Elliott.
December 20, 2014 at 1:20 am #370852Hi,
When I activated the child theme it took me to the “Enfold Theme Options” page. None of my old settings were there. When I activate the child theme do I have to re-enter all of my theme settings again?
Thanks,
JasonDecember 20, 2014 at 6:14 am #370920Hey!
After you activate the child theme, go to Enfold > Import/Export panel. Click Import Parent Theme Settings. Please create a backup of the database before doing this, just in case.
Cheers!
IsmaelJune 11, 2015 at 5:24 am #457601Hi there,
i have the similar problem. My custom URL structure for posts is /blog/%postname%/
However, for blog i want to have /tv/%postname%/
could you please advise if there is now a way to remove ‘blog’ from the portfolio structure without editing any source files?
June 11, 2015 at 8:10 am #457646Hi!
Please try the following
<?php add_action('init', 'portfolio_register_extended', 999 ); function portfolio_register_extended() { global $avia_config; $labels = array( 'name' => _x('Portfolio Items', 'post type general name','avia_framework'), 'singular_name' => _x('Portfolio Entry', 'post type singular name','avia_framework'), 'add_new' => _x('Add New', 'portfolio','avia_framework'), 'add_new_item' => __('Add New Portfolio Entry','avia_framework'), 'edit_item' => __('Edit Portfolio Entry','avia_framework'), 'new_item' => __('New Portfolio Entry','avia_framework'), 'view_item' => __('View Portfolio Entry','avia_framework'), 'search_items' => __('Search Portfolio Entries','avia_framework'), 'not_found' => __('No Portfolio Entries found','avia_framework'), 'not_found_in_trash' => __('No Portfolio Entries found in Trash','avia_framework'), 'rewrite' => array( 'slug' => 'tv', 'with_front' => true ), 'parent_item_colon' => '' ); $permalinks = get_option('avia_permalink_settings'); if(!$permalinks) $permalinks = array(); $permalinks['portfolio_permalink_base'] = empty($permalinks['portfolio_permalink_base']) ? __('portfolio-item', 'avia_framework') : $permalinks['portfolio_permalink_base']; $permalinks['portfolio_entries_taxonomy_base'] = empty($permalinks['portfolio_entries_taxonomy_base']) ? __('portfolio_entries', 'avia_framework') : $permalinks['portfolio_entries_taxonomy_base']; $args = array( 'labels' => $labels, 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array('slug'=>_x($permalinks['portfolio_permalink_base'],'URL slug','avia_framework'), 'with_front'=>true), 'query_var' => true, 'show_in_nav_menus'=> true, 'taxonomies' => array('post_tag'), 'supports' => array('title','thumbnail','excerpt','editor','comments') ); $args = apply_filters('avf_portfolio_cpt_args', $args); $avia_config['custom_post']['portfolio']['args'] = $args; register_post_type( 'portfolio' , $args ); $tax_args = array( "hierarchical" => true, "label" => "Portfolio Categories", "singular_label" => "Portfolio Category", "rewrite" => array('slug'=>_x($permalinks['portfolio_entries_taxonomy_base'],'URL slug','avia_framework'), 'with_front'=>true), "query_var" => true ); $avia_config['custom_taxonomy']['portfolio']['portfolio_entries']['args'] = $tax_args; register_taxonomy("portfolio_entries", array("portfolio"), $tax_args); //deactivate the avia_flush_rewrites() function - not required because we rely on the default wordpress permalink settings remove_action('wp_loaded', 'avia_flush_rewrites')
Best regards,
BasilisJune 11, 2015 at 12:38 pm #457771Hi Basilis,
probably you did not see my complete ticket request in a hurry. As i mentioned……
Could you please advise if there is now a way to remove ‘blog’ from the portfolio structure without editing any source
I really do not want to edit something that will break with updates.
Regards,
HirenJune 11, 2015 at 7:21 pm #457989Hey!
You can add this in the child theme’s functions.php file:
add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod'); function avf_portfolio_cpt_args_mod($args) { $args['rewrite']['with_front'] = false; return $args; }
Flush the permalink settings after.
Regards,
IsmaelJune 23, 2015 at 4:43 am #463123How about just adding this functionality to the enfold theme by default?
There shouldn’t be a need to go into a functions file to fix this. Other plugins and custom post types operate this way. WooCommerce is a good example. We don’t have mysite.com/blog/shop/product-page do we?
June 23, 2015 at 2:13 pm #463390Hey!
Most users want the portfolio permalinks to use the structure they have set in Dashboard > Settings > Permalinks which is why we do not do it by default.
Best regards,
ElliottJanuary 26, 2016 at 12:28 am #571711Hi
Did this request ever get added to the default functionality.
I too do not want to edit the functions file.
I would like my portfolio items to have the URL structure http://www.mydomain.com/portfolio/portfolio-item-name
and my blog posts to have http://www.mydomain.com/blog/blog-post-name
Currently my portfolio items are http://www.mydomain.com/blog/portfolio/portfolio-item-name
Thanks a million.
January 27, 2016 at 1:20 pm #572832Hey!
make your adjustments in Dashboard > Settings > Permalinks a Elliott already mentioned.
Feel free to make a feature request for Kriesi here: kriesi.at/support/enfold-feature-requests/
Gruß,
AndyFebruary 9, 2016 at 6:40 pm #580509I keep changing my permalink to be /%postname%/ and when I go to save it it keeps going back to http://myonation.com/sample-post/. Can you help me fix this?
February 12, 2016 at 8:11 am #582072Hi!
That is the same permalink structure. https://codex.wordpress.org/Using_Permalinks#Choosing_your_permalink_structure
Cheers!
IsmaelMarch 28, 2018 at 1:24 pm #934266Hello, I’m having same issue in 2018.
I had /blog/ added to my permalinks, however /blog/ was also added automatically to portfolio items. I would like my blog to be:
https://www.coma.lv/blog/2018/02/21/kak-blokchejn-mozhet-izmenit-rynok-frilansa/
and portfolio structure:https://www.coma.lv/our-projects/shops/nonpareil/
and each page must be working – Our Projects, ShopsCurrently I have
- This reply was modified 6 years, 8 months ago by vadikcoma.
March 29, 2018 at 12:37 pm #934762Hi,
@vadikcoma: This thread may help.// https://kriesi.at/support/topic/url-structure-for-portfolio-items/#post-835251
The “with_front” parameter of the portfolio custom post type is set to true by default.
Best regards,
IsmaelMarch 30, 2018 at 3:39 pm #935339Didn’t worked at all unfortunately :-(
April 2, 2018 at 2:10 am #935853 -
AuthorPosts
- You must be logged in to reply to this topic.