Overriding parent theme array in functions.php

Hello.

I’m building a new site using elegantthemes Divi theme and I’m using the “project” posts for landing pages.

downside is that when these post types are used, you have to deal with having the word “project” in the url.

I’ve asked the guys over at elegantthemes but they said i could change ‘slug’ => ‘project’, to whatever, which I did, but then the theme was updated and it was changed back. They also said the they do not support any “hacks” to hide or remove this. Hacks…? really?

I believe there’s an easy way to either hide or remove it altogether, but I’m not that familiar with php to do so on my own.

That said, I would greatly appreciate any knowledge that you wouldn’t mind sharing to resolve my problem.

I would like to remove or hide the slug (slug => ‘project’,) in the url using my child theme functions.php file. Can this be done?

This is what I have in my child theme functions.php file now. Obviosly nothing to resolve my issue, but what do I need to add to achieve this?

[php]

<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); } [/php] I have attached a copy of my parent functions.php file for examination. Feel free to edit/add/remove whatever you like. Thanks for helping! Brian --- functions.zip (28.9 KB)

jbg, what do you meant when the theme was updated? Do you mean that you set it up using the
slug->project and then changed all the code…?

Not sure what you are meaning by that. And, YES, ANYTHING can be done with enough knowledge of your
code and how it works.

I am not a WP programmer and not familiar with Divi theme, but, I think you should be able to solve it.
Their people said to alter the slug which is obviously a parm that is used throughout the theme. If you
load the theme it should use the parm, but not clear on how you are using the changes… I think to do
a removal of it would be tricky because they have it set up to be a url of like xyz/slug/123 so removing
it would make it xyz//123 and so it would not work. But, replacing it to say JBG it would be xyz/JBG/123
which would work. I can look into the theme, but explain “when the theme was updated” means…

Oh… Apologies for the confusion… Every so often elegantthemes will do an update to in order to stay compatible with the latest version of the WordPress. I had made some changes to the css file only to be overwrote by theme update. So I setup a child theme, have the css overwrite issue resolved, but since the functions.php in a child theme gets added on top of the parent functions, whatever is put in the child functions.php must replace the function(s) in the parent.

But thinking about it, the project post types use categories just as standard posts. It would be awesome if the project category could be used?

Sorry. I hit post instead of preview…
Anyhow, finishing up my last post - what I wanted to say was “inplace of the ‘project’ url.”

Well, a template is really for you to customize to fit your uses and then lock it into place.
If the owner of template improves it, and you reload the newer version, then you must
replace all of your updates you created and all of your own improvements and changes.

As far as customizing a “template” goes, you should remember they are guidelines that
should be used to be customized and when they work, done-deal!

I will look at the WP template and see if I can figure it out. Might take a bit.

Oh, one quick idea, in the display area where it uses the SLUG, you might just be able to
take it out of the formation for the URL’s… Then, it is just gone. You would have to do that
in the WP section where the post area is actually displayed and the URL is created. Not sure
where that might be without viewing the code some… But, will try to peek at it…

Brian, I tried to look at the code, but, it was $69 to download the theme.
I bet they want a ton of money to customize it for you. So, can’t really help
you a lot.

I did see the landing page, but, of course the code was hidden. You could post
just the small section of code on the landing page where it displays the post you
are trying to fix. Maybe then we would know where to steer you…

Customization is the whole idea behind the child theme. You make your changes there so your mods aren’t overwritten by the periodic update.

Anyhow, i really appreciate your help!

Thanks

Yep, but, can spend the $69 to see your code…
I will grab your functions you posted and see if anything jumps out…

Here’s the whole theme… http://www.mediafire.com/download/9x0tdcdktylc3rl/Divi.zip

Brian, I peeked at your functions… It was of course just partial code when you think of the entire template.
Not sure how it all intermingles…

So, something like this line:
$category_classes[] = ‘project_category_’ . urldecode( $category->slug );

Creates the category class array using the URL of locked in project_cateory and appends the default
slug. So if slug=“briansProject” it would end up with " project_category_briansProject "…

Seems to me you could just drop the added in url and then it would be a blank. I am assuming that the
unseen code in the front-end of the WP theme converts the underscores into slashes so that the real
live URL becomes " project/catagory/briansProject/ " , and that means that it might work to just remove
that part.

Did that make some sort of sense. Oh, just see you posted the whole theme. After I grab it you should
not leave it there because it is a copyright issue. You really should never post paid items. You can pass
them to trusted people by sending them inside of private messages. Thanks will grab it now. I will not
use it illegally unless I pay for it. Thanks!

Yeah let me know when you’ve got it so i can take it down. Thanks

Yes, I have it, close it out. I promise I will delete it when we are done in this thread…

Did you read the last post just before this one? Where I explained where the SLUG was used?

Did you try that fix?

I will when I get home.

Thanks

…yeah that didn’t work. Or perhaps I’m not putting it in the right place??

Anyhow, did you get a change to look at the theme coding?

Let me know.

Thanks.

Brian

Brian, yes, I did look at it. I appears to only be a few places where they use the slug=>‘project’ codes.

I have been peeking at the code, but, there is a lot to it. I have had very little time today and it is 11:20 PM
already. So, I hope to have more news for you tomorrow. I think it can be done with just a small change it
their code. (Basically, make the slug=>’’ and then we will have to edit the url to remove the // that appears
when you remove the slug. ) I think it is just adding one line of code, but, have to figure out how it all does
interact with the rest of the template.

Hopefully, tomorrow, my friend… Talk to you then, Ernie…

Hey Ernie.

Take your time… I just really appreciate your help!

Thanks.

Brian

Brian

Do you have a link to the live page so I can see it in action? If you want to keep it private, just
send it to me in a private message.

I don’t want to install the theme on my server as I did not buy it. But, the code seems easy enough.
Just want to actually see how it is rendered to the browser… (That means, look at it live and view the
source code after the PHP sends it to the browser!)

Thanks, Ernie

Yes…
http://gotagiveaway.com/giveaways/omega-j8006-juicer/

I changed the slug manually just so i could see what it looked like… Otherwise the word “giveaways” would be “project” and categorically unchangeable…

Thanks again Ernie.!

Brian,
So, you want this:

http://www.gotagiveaway.com/giveaways/omega-j8006-juicer/

To be like:

http://www.gotagiveaway.com/omega-j8006-juicer/

???

Yes. That’s it.

Sponsor our Newsletter | Privacy Policy | Terms of Service