How do i disable submenu links in wordpress? - wordpress

As soon as you create a menu item for a page there is a link that it automatically populated with it. How do i stop wordpress from making these links? I'm capable of making them myself and don't always want them to link to thier specific page.

I figured it out using and dropping it in my header.php
<script type="text/javascript">
jQuery(function($) {
$("li.menu-item-627,li.menu-item-14,li.menu-item-20,li.menu-item-28").children("a").attr('href', "javascript:void(0)");
});
</script>
You have to use firebug or chrome "inspect element" to find out what your menu items are and then just replace the numbers in the code accordingly.
also if you don't want them to show up at all add the following code
<script type="text/javascript">jQuery(function($) { $("li.menu-item-627").contents().hide();});</script>
those two together will hide the disabled menu link
you can then add your own links in the "navigation label" of the page menu field!
good luck and let me know if you have any questions, i will do my best to help!

Related

Make an iframe in Wordpress open links in the parent window

Here is my problem, I have an iframe of a wordpress page (with stripped header/fooder/sidebar) with lots of links and I want when the user clicks on the links for them to open on the parent window and not the iframe.
I know I can use:
<a target="_parent" href="http://url.org">link</a>
on the links, but since the links point to wordpress posts and the list of posts is updated dynamically, this isn't a very good option. I can't edit them one-by-one to add the target. Plus, it might interfere with the rest of the site's links.
Another option is to use
<base target="_parent">
on the iframe header but I don't know how to do that.
Suppose I have this code to add the iframe:
<iframe class="bg-dark3" style="border: none;" src="https://www.google.com" scrolling="no"></iframe>
Where and how can I add the <base target="_parent"> line?
You can add this to your Wordpress site. It's Jquery to open the links in the parent. So please make sure Jquery library is loaded.
$('a').click(function(){
//Get url from anchor
var link = $(this).attr('href');
//Open url in parent
window.parent.parent.window.location = link;
});
This will automatically open the links in the parent, you wouldn't need to add target=_parent to each link manually.

How to add custom css in wix website

I am new at wix and editing a website and want to add css in a page. but not found any option for css.
Anybody know how to add custom css code in wix website?
Thanks
You can do this by embedding inline styles to every page, via creating a chunk of custom css code contained between <style> and </style>.
Go to your site's dashboard.
Click Manage Website on the left.
Click Tracking & Analytics.
Click + New Tool **and select **Custom from the dropdown.
Set up your custom code:
Enter your custom code.
Select the relevant domain. Note: This option will appear only if you have multiple domains.
Enter a name for your custom code.
Add Code to Pages: Select which pages to add your code to:
**All Pages: **Click the dropdown to select an option:
Load code once.
Load code on each new page.
**Choose specific pages: **Begin typing the name of the relevant pages and then click the checkbox next to the relevant page.
Place Code in: Select where the code snippet in placed in your site's code:
Head - as noted by #Daniel Gurtner, avoid this because it'll insert it BEFORE any of the inherent styles, which makes it mostly useless here.
Body - start
Body - end Note: I'd recommend adding your style chunk here to avoid having a delay effect on your loading
Click Apply.
Wix keeps on updating this but I have found where the place described in the most voted comment is for now. I don't have enough "reputation" to add a comment to the thread, hence why this is an answer.
Go to Settings and scroll to Advanced(the last section) and you can see Custom Code. The rest of the steps are the same.
Click Add on the left in the editor.
Click More → Embeds.
Drag the HTML iframe to the site.
Click your iframe and click Edit Code.
Then type:
<style>
/* CSS Code */
</style>
As of 2022, you can add it from your Wix Dashboard under Settings > Advanced > Custom code.
Click the Add Custom Code button. Enter your CSS in the Paste the code snippet here: textarea. Make sure to wrap it within <style type="text/css"></style> tags. Set the Code Type as "Essential" as it doesn't require user consent to load.
Note: You won't be able to see your CSS from the page editor nor Preview mode. You have to Publish it and view it from the frontend.
Wix Add Custom Code screenshot
Follow these steps to add CSS in Wix.
Go to your site’s dashboard.
Click Manage Website on the left.
Click Tracking & Analytics.
Click + New Tool **and select **Custom from the dropdown.
Set up your custom code:
Enter your custom code.
Select the relevant domain. Note: This option will appear only if you have multiple domains.
Enter a name for your custom code.
Add Code to Pages: Select which pages to add your code to:
If you need more help with Wix Web Development visit wix.com/forum.
I just tried it on 6th Sep 2021. Yes it is possible to add CSS & JS custom code.
At the same place of writing custom HTML code
For CSS code add,
<style type:"text/css"> CSS CODE HERE </style>
For JS Javascript code add,
<script> JS CODE HERE </script>
The steps in previous answers did not work for me. It seems the interface has changed.
The following steps work with the new UI:
Go to your site's dashboard
Click settings in the left sidebar
scroll down to the "Advanced" section
Click "Custom Code"
All carriage returns within the embedded code will show up as \n on the output, rendering the code non-functional.
You could also achieve this by setting the .html property of your object (#id) in Velo.
The following example adds a drop shadow to your object with id equal to #id:
$w("#id").html = "<p style='filter: drop-shadow(1px 8px 4px #4444dd)'>test</p>"
Below snippet shows the result in pure HTML.
<p style='filter: drop-shadow(1px 8px 4px #4444dd)'>test</p>
You can't. This is not a feature provided by Wix.
ref. other ref.

Change wordpress menu href

I wanna change the href of a specific menu item on all pages. Is this possible? Where should I put the code?
I also added this javascript to the end of a specific page:
<script type="text/javascript">
document.getElementById("menu-item-100").href="xyz.php";
</script>
It didn't work even though when I viewed the page source it showed that the script was placed after the original href of the menu.
I don't wanna use custom links.
Try putting this in your footer.php
<script>
jQuery(document).ready(function($) {
$("#menu-item-100").attr("href", new_href);
});
</script>
Wordpress a lot of the times needs to have jQuery(document).ready(function($) for no-conflict reasons.
Try it, may be helpful to you:
$("#menu-item-100").attr("href", new_href);
Apparently the element with the ID of menu-item-100 had an a tag inside of it; so I had to retarget the whole thing.
This fixed the whole thing.
document.getElementById('menu-item-100').getElementsByTagName('a')[0].href="THE LINK";
Thanks to #NooBskie I put it inside the footer.php and it affected all the pages.

Anchors not working on search results page using woocommerce

I am developing a site for a client using Wordpress and Woocommerce and have an issue where I can not click on any of the anchors on the search results page.
The search results page is here: http://79.170.44.83/newcityused.com/?s=chair
I can see nothing in the CSS that would make this happen.
I have deactivated all of the plugins with no joy.
I'm lost.
Has anyone else experienced this or know of a solution?
You have a class .search inside your 'body' tag and then you have a js that is something like this:
jQuery(function(){
jQuery('.search').on('click', function(e) {
jQuery('.search-form').toggleClass("expand");
e.preventDefault();
});
})
I think that you are preventing the default clicks in here... so remove the e.preventDefault it made work, let me know...

Mouseover links display in Drupal Views

I would like to know whether there are any Drupal (6.x) modules and/or theming tutorials that can implement the effect of hiding and showing certain (clickable) elements of a view listing only when on mouse hover within the item's div (and not as a tool tip or popup). e.g. in http://rusoom.com/ the Author, Like, Info and Share links of each image (view item) only show on mouse over.
Another example will be the display of Favorite, Retweet and Reply displayed on each tweet on mouse-hover, when logged in to Twitter (http://twitter.com) and viewing any tweet stream.
Any help will be deeply appreciated.
Thanks in advance.
I would use the mouseover function in jQuery and create my custom JavaScript code (in a custom module or in the theme). Here is an example of the code:
file: sites/all/themes/MYTHEME/template.php
<?php
function MYTHEME_preprocess_page(&$variables) {
drupal_add_js(drupal_get_path('theme', 'MYTHEME') .'/mytheme.js', 'file');
}
?>
file: sites/all/themes/MYTHEME/mytheme.js
$('.box').mouseover(function() {
$('.hidden').show();
})
HTML (Views generated code)
<div class="box">Mouse over me to see hidden content</div>
<div class="hidden" style="display:none">This is hidden</div>
This is a quick mockup but it should get you in the right direction. If there isn't a module for this you can consider making one from this code!
Good luck

Resources