We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

How do I change the "Main" URL | Forum

Topic location: Forum home » Support » General Questions
Emil
Emil Aug 5 '17
Hi all,

all I'm trying to achieve is pretty simple really, I just can't seem to find how to change.


I want to change the URL of the Main menu button to go to /index?v=1 instead of just /index


I want to do that because the google ads don't want to show on the index, but when you add a useless attribute like this and the end of the URL the ads actually do show. Thanks.



Darryl B Leader
Darryl B Aug 5 '17
Check this on Stackoverflow. It looks like it may work for you.

https://stackoverflow.com/...jquery-or-javascript

I'm guessing in your case one of them would look like this. You can try this in the body section in admin / settings / page settings. I add the /* to make sure the script doesn't work here. There are several examples like this on this web telling how to add an attribute to a url.

/*
<script>
$('.base_main_menu a').attr('href',function(i,str){
   
return str +'?v=1';
});
</script>
*/
The Forum post is edited by Darryl B Aug 5 '17
Emil
Emil Aug 6 '17
Thanks for the reply Darryl, the first script didn't work for me but I modified it a bit to this:


/*

<script>$('.base_main_menu_index a').attr('href',function(i,str){    return str +'?v=1';});</script>

*/


 and it worked! Thanks a ton!

The Forum post is edited by Emil Aug 6 '17
Darryl B Leader
Darryl B Aug 6 '17
Yea. I didn't notice at first. When I pasted the code in the first time it ran parts together. I corrected it, and reposted. Glad it worked for you.