We help IT Professionals succeed at work.

WordPress

WordPress is a free and open-source content management system (CMS) based on PHP and MySQL for creating websites and blogs. Features include a plugin architecture, a template system and strong management, customization and search systems; through its dynamic presentation of content, webmasters have the flexibility to create websites easily.

jquery Click to Show Content element - Needs to work independent of each other when there are 2 on the same page - Currently they hide items  on the other section when clicked

I have two scripts in the header - one for each section of the home page https://guardianman.wpengine.com/ 

This is my existing code

<script>
jQuery(document).ready(function($) {
   // Code that uses jQuery's $ can follow here.
	$('[data-switch]').on('click', function (e) {
		var $page = $('.awesome'),
			blockToShow = e.currentTarget.getAttribute('data-switch');

		// Hide all children.
		$page.children().hide();

		// And show the requested component.
		$page.children(blockToShow).show();
	});	
});
</script>	

Open in new window


<script>
jQuery(document).ready(function($) {
   // Code that uses jQuery's $ can follow here.
	$('[data-switch]').on('click', function (e) {
		var $page = $('.awesome2'),
			blockToShow = e.currentTarget.getAttribute('data-switch');

		// Hide all children.
		$page.children().hide();

		// And show the requested component.
		$page.children(blockToShow).show();
	});	
});
</script>	

Open in new window


So currently if I click on one item the content gets hidden in both sections - I only want the content in each section to be hidden and shown on click but not have the the other section affected.


HTML for each of the two sections -

--Section 1 --

<div id="awesome" class="who-icon-wrapper"  >
	
	
	
		<button class="icon-one" data-switch="#ico-one">
			

Open in new window

0
Hi:

I'm simply trying to add a sentence to a home page.  I clicked "Edit" in the Pages section of WordPress and specifically for the Home Page.

Then, I pasted the text into the Text tab.

But, upon clicking "Preview Changes", the new text does not appear.  

The home page has sliding pages.  Is that why?

Afterward, I reviewed Widgets in the Appearance section of WordPress.  Then, I went to "Front Page".  I cannot figure how to do add the text, here.

I'm surprised that this sort of thing isn't easier to accomplish.

How do I add a sentence to the Home Page?

Thanks!

Software Engineer
0
I've been unable to find where the white space is coming from under the header on this page: https://shop.netherbymeats.co.nz/about-us/

Other pages in the site don't have the gap, and the dev tools in Chrome and Firefox don't appear to shed any light on why it's there, as far as I can tell.

This site is built with the Elementor plugin in WordPress.
white-space-under-header.jpg
0
Hello,

Please follow this link and see my category slideshow

http://paula.darkstarmedia.net/category/dance/

I have edited the archive.php page in wordpress to display the most recent  posts featured images in a slideshow, in the category page you are on.

The images are working perfectly, the problem is I am trying to display the title below the image, but as you can see it is grabbing 2 random titles and overlapping them, on top of that the 2 aren't connected to the image.

This is my code

<?php
$category = get_the_category(); 



if( ($category[0]->cat_ID  == 7 && is_category() ) || 
  ($category[0]->cat_ID  == 4  && is_category() ) || 
  ($category[0]->cat_ID  == 1101 &&  is_category() )|| 
	 ($category[0]->cat_ID  == 5  && is_category() ) || 
  ($category[0]->cat_ID  == 3 &&  is_category() )   ) {

?>
<div id="myCarousel" class="carousel slide" data-ride="carousel" >

<!-- Wrapper for slides -->

<div class="carousel-inner">

<?php
$write_active = "active"; 
$args = array(  'posts_per_page' => 5, 'orderby' => 'post_date', 'cat'=> $category[0]->cat_ID  );
$loop = new WP_Query( $args );

while ( $loop->have_posts() ) : $loop->the_post();

echo '<div class="carousel-item '.$write_active.'  " >';
$write_active = ""; 
	
	if (has_post_thumbnail()):
           the_post_thumbnail('default-thumbnail');
      else:
     		echo '<img src="'.$default_thumbnail.'" alt="'.the_title().'" />';
	 endif; 
echo '</div>';


echo '<div class="carousel-caption">';
	echo 

Open in new window

0
Hi Experts,


How can I have a WordPress page retrieve text from a page on another site?

Sorry if this question is too vague - I'm just trying to plan something new.

Regards,

Leigh
0
I have some css over riding my themes CSS, but it doesn't exist anywhere, yet I can see it in the web inspector

paula.darkstarmedia.net:1 is not a style sheet, also I did a search of entire theme and code does not exist. This is also a widget so it has no inline CSS

I need to be able to overwrite this, please help.
http://paula.darkstarmedia.net

It is the comment section at the bottom, the links, not author  

View from web inspector
paula.darkstarmedia.net:1

.recentcomments a {
display: inline !important;
padding: 0 !important;
margin: 0 !important;
}

Open in new window

0
Hello,
I have a wordpress site going and was wondering if there is a way via wordpress or something else to make item's on an image clickable.  See attached, each round circle I have a doc for. I'd like to link the circle to the doc's but not sure how to go about this. Thank you!A.M-HW-SOLUTIONS-Healthy-Lifestyle-M.png
0
Hi Experts,

I have a primary domain with WordPress, that is mainly content. Now I am building a custom PHP application in a subdomain, and I need to show a form from the subdomain in the primary one, with all includes, etc.

Is it possible to have a iFrame in WP (or anywhere for that matter), so it does not have scroll bars, but actually have a natural flow, sort of  overflow visible?

Any help will be appreciated.
0
Hi there,  I am getting a Uncaught TypeError: Cannot read property 'open' of undefined error, on Line 14. This is a function, that will open a popup on page load.  Not sure hoe to rectify it?

jQuery(document).ready(function($) {
	// Parse the URL
	function getParameterByName(name) {
	    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
	    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
	        results = regex.exec(location.search);
	    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
	}
	// Give the URL parameters variable names
	var access = getParameterByName('access');
 
	// if access does not = yes then display the popup
	if (access != 'yes') {
		$.magnificPopup.open({
		  items: {
		    src: 'https://go.buildertrend.com/l/464372/2020-03-20/7sshdx'
		  },
		  type: 'iframe', modal: true
		});
	}
});

Open in new window

0
Hi Experts,

If you go to www.iwscc.ca you will see in the header 2 orange buttons: Corporate and Self-Registration, both going to #

Under WP Admin, I see that this theme is called Nonprofit, and the buttons are set in Theme Options >Address Bar, and ou will see in the snapshot that I can set the buttons label, but not the url. My questions are...

1- How do I remove the Corporate button? If I leave it blank, I just get an orange square.

2- How can I actually set an url to these?

I know I can create a child theme, and address #1 with CSS and #2 with JS, but I think there should be an easier way since the theme provides these buttons.

BTW- even though in the screenshot it says Webdivia, under themes it says Nonprofit. I just inherited this website.

Thank you,
wp admin
0
My code is working but i get a console error: Should I ignore it?
Uncaught Error: Syntax error, unrecognized expression: #lips/

URL is https://allgood.flywheelsites.com/shop/#lips/

Here is my code: the trailing slash was breaking this code but i finally got it working.
var url = window.location.href.replace(/\/$/, '');
var lastPart = url.substr(url.lastIndexOf('/') + 1);
if (lastPart === "#lips") {
jQuery('input.jet-checkboxes-list__input').each(function(){
var catagory_value=jQuery(this).val();      
for (var i=0;i<catagory_value[0].length;i++) {
if (catagory_value == "129") {
jQuery(this).parent().addClass("lips");
jQuery(window).load(function() {
      jQuery('.lips .jet-checkboxes-list__input').trigger('click');
});
} } }); }
0
WordPress Query is very slow.

I inherited a site with one piece of custom code.  It basically grabs products from the Database and orders them and displays them through a shortcode.  The issue is, when I turn off the code the page loads very fast but with the code working it takes about 3 seconds to return the query to return.  I tried to switch over to the proprietary way that woo would grab products but it is still really slow.  Can anyone look at the following code and suggest how to speed it up?  I even thought of forcing the code to load last?

NOTE: if I change this to "Not Empty" it does not do what it is designed to do but it speeds up:
if ( empty($prodData) ) {


<?php
$shortcodeId = 'swift-cross-sell item-' . random_int(9999, 99999999);
$skus = explode(",", $atts['skus']);


//if( !is_admin() ){
  $cacheKey = 'key_products_' . implode('_', $skus);

 
$loopData = WC()->session->get( $cacheKey );


  if ( empty($loopData) ) {
    $args = [
      'post_type'  => ['product', 'product_variation'],
      'meta_query' => array(
        [
          'key'   => '_sku',
          'value' => $skus,
          'compare' => 'IN',
        ],
      )
    ];

    if ( ! empty( $atts['tag'] ) ) {
      $args['product_cat'] = $atts['tag'];
    }
    $loopData = new WP_Query( $args );
    WC()->session->set( $cacheKey , $loopData );
    
  }
//}
  


$loop = [];
while ( $loopData->have_posts() ) {
  $loopData->the_post();
  $productId = get_the_ID();
  

  //if( 

Open in new window

0
I've added a custom widget to a WordPress site that I'm currently updating, and have done so by adding the following code snippet to the functions.php file in my child theme:

function ts_custom_widget_setup() {	
	register_sidebar(
		array(	
			'name'	=> 'Disclaimer Text',
			'id'	=> 'disclaimer-text',
			'description' => 'Disclaimer Text',
			'before_widget' => '',
			'after_widget'  => '',
			'before_title'  => '',
			'after_title'   => '',
		)
	);	
}
add_action('widgets_init','ts_custom_widget_setup');

Open in new window


I'm now trying to add the widget's dynamic content to my footer.php file using the following:

<?php dynamic_sidebar('disclaimer-text'); ?>

Open in new window


... however, .. this is adding an unwanted HTML wrapper around the dynamic content, which I'm trying to eliminate:

<div class="textwidget custom-html-widget">testing dynamic disclaimer text</div>

Open in new window


How can I remove the "<div class="textwidget custom-html-widget"></div>" wrapper/html from the rendered HTML .. without adversely effecting the other dynamic widgets that I have in my bottom footer (which actually require those wrappers)?  Is there some way that I can do a search and replace using PHP?  If so, how?

For reference, .. I've been asked to make the fine print at the bottom of this page editable through the WordPress backend, .. which was itself easy to accomplish, .. but is proving to be difficult when rendering the dynamic output on the front end:

https://touchstoneliving.com/

Please advise.

Thanks,
-- Yvan
0
I am experiencing an error caused by a custom piece of code.  It is to show related products.  The error is found in the logs and it is effecting the Admin when you edit a page and save.  The following is the error from the log:
> Error Details
> =============
> An error of type E_ERROR was caused in line 28 of the file
> /nas/content/live/swiftstagingne/wp-content/themes/Avada-Child-Theme/t
> emplates/shortcodes/swift-cross-sell.php. Error message: Uncaught
> Error: Call to a member function have_posts() on null in
> /nas/content/live/swiftstagingne/wp-content/themes/Avada-Child-Theme/t
> emplates/shortcodes/swift-cross-sell.php:28
> Stack trace:
> #0
> /nas/content/live/swiftstagingne/wp-content/themes/Avada-Child-Theme/c
> ustom_shortcodes.php(18): include()
> #1 /nas/content/live/swiftstagingne/wp-includes/shortcodes.php(325):
> swift_cross_sell(Array, '', 'swift-cross-sel...')
> #2 [internal function]: do_shortcode_tag(Array)
> #3 /nas/content/live/swiftstagingne/wp-includes/shortcodes.php(199):
> preg_replace_callback('/\\[(\\[?)(swift\\...', 'do_shortcode_ta...',
> '[fusion_text co...')
> #4
> /nas/content/live/swiftstagingne/wp-content/plugins/fusion-builder/sho
> rtcodes/fusion-column-inner.php(549): do_shortcode('[fusion_text
> co...')
> #5 /nas/content/live/swiftstagingne/wp-includes/shortcodes.php(325):
> FusionSC_ColumnInner->render(Array, '[fusion_text co...',
> 'fusion_builder_...')
> #6 [internal function]: …
0
Hi Experts,

This is a multi-part question, which I cannot split, so bare with me.

1- When you first go to www.iwscc.ca you will see a sign-up form, but I cannot seem to find any associated plugin for it. Is it coming from Mail Chimp Directly?

2- I cannot remember if I signed up, or hit "X" one too many times,. but within Chrome I no longer see the form. How do I get it back?

3- Is it possible to trigger a Newsletter send every time a new Blog Post is added?

Thank you.
0
I'm trying to get the buttons on my home page to be the same size and centered.  This clearly isn't my strong point.

How do i modify the css so these buttons will be forced to the same width (why is one so wide when the text isn't that wide?) and centered on the page?

Page is at https://nyackboatcharter.com/.

Thanks.
0
WordPress site using the Avada Theme. Facebook Meta tags are showing twice:

Can anyone explain to me why the facebook meta tags are showing twice?  I am using Yoast.
ipopla.com is the site where this is happening.  For the life of me I can not figure it out.
0
This code is everywhere on the web, however it doesn't work.

function remove_image_zoom_support() {
    remove_theme_support( 'wc-product-gallery-zoom' );
}
add_action( 'wp', 'remove_image_zoom_support', 100 );

Open in new window

Here is an example page:

http://sandbox.intrepidrealist.com/cazoozsb/product/ukulele-for-beginners/

I really need to disable the Zoom on single product views. are there any Woo experts out there who've accomplished this?
0
I am using jQuery to add a Class to the first <p> selector within a div wrapper with a class .addline using this:
jQuery( ".addline p" ).first().addClass( "leftline" );

This works great and adds that class to only the first <p class="leftline"> within <div class="addline">

but sometimes <p> is not the first selector I want to add that class to. So I need jQuery to only look for the first of one of these: var ary = ['p', 'h2', '', 'h3', 'li', 'ol'];

I thought maybe I could do something like this:

var ary = [$p_selector, $h2_selector, $h3_selector, $li_selector, $ol_selector];

var $p_selector =  jQuery( ".addline p" ).first();
var $h2_selector =  jQuery( ".addline h2" ).first();
var $h3_selector =  jQuery( ".addline h3" ).first();
var $li_selector =  jQuery( ".addline li" ).first();
var $ol_selector =  jQuery( ".addline ol" ).first();

Then use an IF statement or something.?

Here is a video to help explain.
https://www.loom.com/share/27fd9940e39c4bcc8c30a65965dc3c2c

Sample Page: https://allgood.flywheelsites.com/all-goods-comprehensive-guide-to-non-toxic-natural-remedies-for-eczema/
0
Is there a plugin or other way to keep the utm tracking parameters from one page to another while the user browses a wordpress site.
0
I am using Elementor plugin with WooCommerce in WordPress and since updating the plugin to latest version 2.9.2, The plugin stopped working. When I click on edit with Elementor it forces me to enable safemode and this is the error it logs in the debug logs

 [error X 2][/wp-content/uploads/elementor/editor.min.js:7:49075] this.config.initial_document.urls is undefined 

Open in new window


I have tried to reach out the plugin developer but no response from them at all as this a free plugin so comes with no or limited support.

I am hoping if someone from the Experts Exchange community can advise in how to fix this error.

Thanks and appreciate it
0
My Wordpress banner at www.barnwellmd.com overlaps when the page is full size in a desk top (see below). How do I fix that?
banner
0
So I would like to set up my Woo-commerce store to only collect real time tax rates from the following states only. If you are not in these states you do not pay tax and if you are then you pay the applicable real-time sales tax rate based on where you live in the state
 
Arizona
Colorado
Florida
Minnesota
Tennessee

What is the best way to set this up in woocommerce?
0
On a page I am developing the page titles are also at the beginning of the excerpts on most of the feed items - those pages are using the divi builder, so the reader is seeing the title module as part of the page content.

I'm wondering if there is a way to work with this function that is creating the display to do something like a str_replace to have it check for and remove the title from the content (or a better approach along that lines):

public function display_feed()
{
	if (!$this->settings['ajax'] || $this->is_cached)
		:
	$output = '
<div' . $this->get_wrapper_classes() . '>';
	$output .= '
	<ul class="wp_rss_retriever_list">';
	foreach ($this->feed_items as $item) {
		$output .= '
		<li' . $this->get_item_inline_css() . ' class="wp_rss_retriever_item">';
		$output .= '
			<div class="wp_rss_retriever_item_wrapper">';
		$default_layout = array(
		'title',
		'thumbnail',
		'content',
		'postdata'
		);
		$layout = apply_filters( 'wp_rss_retriever_layout',  $default_layout);

		// set the default layout values (title, thumbnail, content, postdata)
		foreach ($default_layout as $default_layout_item => $value) {
			if (false !== $key = array_search($value, $layout)) {
				$func_name = 'get_' . $value;
				if (method_exists($this, $func_name)) {
					$layout[$key] = $this->$func_name($item);
				}
			}
		}
		// add layout items to the output
		for ($i=0; $i < count($layout); $i++) {
			$output .= $layout[$i];
		}
		$output .= '</div>';
		$output .= '</li>';
	}
	

Open in new window

0
I am relatively new to Wordpress and am trying to add code to a page.
Here is the code:

<div id="libchat_97a02353a0afcdc8a5eab67b19250e53"></div><script type="text/javascript" src="https://v2.libanswers.com/load_chat.php?hash=97a02353a0afcdc8a5eab67b19250e53"></script>


Although I have worked with PHP, javascript, and html extensively, I am at a loss on how to get Wordpress to recognize this code. I use the html editor on the page and the result is it simply displays the code, it should display a widget.

Any tips would be greatly appreciated.
0

WordPress

WordPress is a free and open-source content management system (CMS) based on PHP and MySQL for creating websites and blogs. Features include a plugin architecture, a template system and strong management, customization and search systems; through its dynamic presentation of content, webmasters have the flexibility to create websites easily.