Tagged: Custom Post Type
-
AuthorPosts
-
June 22, 2017 at 2:41 pm #811556
Hi,
how can I change the with_front value from true to false for the custom post type “portfolio”?
With with_front=true my permalinks for portfolio entries are with /blog/ in slug (because of my permalinks settings). With changing with_front=false I will optimize my url structure for permalinks (do not need /blog/ in the url).
Any filter or code in functions.php for that?
More information to with_front please have a look here (> Parameters > Rewrite): https://codex.wordpress.org/Function_Reference/register_post_type
- This topic was modified 7 years, 6 months ago by Mathuseo.
June 25, 2017 at 1:26 pm #812662Hey Marcel,
You might find more info here:
https://developer.wordpress.org/reference/functions/register_post_type/#user-contributed-notes
https://wordpress.stackexchange.com/a/53303
http://www.wpbeginner.com/wp-tutorials/how-to-create-custom-post-types-in-wordpress/Are you creating your custom portfolio type?
Best regards,
Victoria- This reply was modified 7 years, 6 months ago by Victoria.
June 26, 2017 at 8:05 am #812910Hi Victoria,
if a Custom Post Type already registered (as the Enfold CPT ‘portfolio’) can I change the ‘rewrite’-argument similar to the code you have posted in your link?
To your question: No, Custom Portfolio Type was created by Enfold. I use a demo, not sure what but the Custom Post Type was not created by meyself. That’s why I ask, how to change one of the attributes because I do not want to change it in source code of Enfold core files.
In which file of Enfold theme the Custom Portfolio Type is created?
- This reply was modified 7 years, 6 months ago by Mathuseo.
June 26, 2017 at 11:45 am #812994This looks interesting to me: https://kriesi.at/support/topic/change-the-portfolio-items-name-in-admin-to-something-else/#post-679259
Any idea how to modify the code to change the with_front parameter?
June 26, 2017 at 1:07 pm #813037Hi Mathuseo,
Well, judging from the thread you will have to modify the Enfold files and you only need to flip the flag. Have you tried the code from the Ismael’s reply?
Best regards,
VictoriaJune 28, 2017 at 8:26 am #813710No because Ismael’s post is about 1 year old an I am not sure if there was bigger changes by registered Post Type.
Any idea where in source files of enfold theme I can find the Post Type Registration?
So I can modify Ismaels code as I needed.June 29, 2017 at 10:16 am #814314Hi Mathuseo,
I think the easiest thing to do, is to try the code that you have and check if that works for you.
Best regards,
VictoriaJune 29, 2017 at 1:49 pm #814467Hi Victoria,
I’ve tried the way Ismael suggested here [1] but didn’t work:
/* Change portfolio post type settings */ 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; }
His post is older than 2 years! Lot’s of things could change since them, f.e. filter name, …
Can someone help please?
- This reply was modified 7 years, 5 months ago by Mathuseo.
June 29, 2017 at 2:00 pm #814476If I change the rewrite-argument in core files (/wp-content/themes/enfold/includes/admin/register-portfolio.php) it would not be change as well. Why?
Screenshots:
Image: https://picload.org/view/rpdaidor/portfolio-items-1.png.html
Image: https://picload.org/view/rpdaidii/portfolio-items-2.png.html- This reply was modified 7 years, 5 months ago by Mathuseo.
July 3, 2017 at 6:58 am #815747Nobody can help?
July 4, 2017 at 5:54 am #816159Hi,
I’m sorry for the late response. After adding the filter above, did you flush or resave the permalinks?
/* Change portfolio post type settings */ 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; }
Best regards,
IsmaelJuly 4, 2017 at 8:22 am #816207Hi Ismael,
yes, I flushed and resaved the permalinks. “with_front” is still ‘true’.
Did you test the filter in your staging environment? Did it work?I could send you ftp credentials and wp admin access, to have a look in my theme files and backend.
Would help?July 6, 2017 at 12:19 pm #817180Can anyone help?
July 7, 2017 at 11:45 am #817768Hi Mathuseo,
Try adding higher priority to the filter, like 20 or more.
add_filter('avf_portfolio_cpt_args', 'avf_portfolio_cpt_args_mod', 20);
Best regards,
VictoriaJanuary 28, 2019 at 1:20 am #1059481Mathuseo. I’m having the same issue and arrived at the same conclusion and road block with the “includes/admin/register-portfolio.php” file. I know this is an old thread, but if you solved the issue, please let share the solution.
I’m not a developer.
Vielen dank
January 30, 2019 at 8:55 am #1060375Hi,
Please continue on that thread: https://kriesi.at/support/topic/blog-and-portfolio-categories-nested/#post-1059477
We’ll close this one now.
Best regards,
Ismael -
AuthorPosts
- The topic ‘Change with_front=true from portfolio entries (custom post type)’ is closed to new replies.