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.

Share tech news, updates, or what's on your mind.

Sign up to Post

I want to use ux blocks to create content on certain pages of my site.  How do you call within a php function a specific block and how do you specify a certain page that it be displayed on?  I am familiar with filters and hooks.  I just don't know the proper way to call a UX Block or how to specify it show on certain pages only.

I am using Woo Commerce 3.6.4 and Flatsome 3.0
0
This is a follow-on question to
https://www.experts-exchange.com/questions/29145432/Need-WooCommerce-Product-Short-Code-That-Uses-Thumbnail.html?headerLink=workspace_answered_questions

Open in new window


Here is my code
add_shortcode( 'cs_product_image', 'cs_product_image_callback');
function cs_product_image_callback($atts = []) {
    $atts = shortcode_atts( array(
        'id' => null,
    ), $atts, 'cs_product_image' );

    $product = new WC_product( $atts['id'] );
    $product_img = wp_get_attachment_image( $product->get_image_id(), 'woocommerce_gallery_thumbnail' );
    return $product_img;
}

Open in new window


For some reason, this is causing a fatal error.  Here are the log details:

2019-05-29T14:18:45+00:00 CRITICAL Uncaught Exception: Invalid product. in /data/web/theherbsplace.com/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php:163
Stack trace:
#0 /data/web/theherbsplace.com/wp-content/plugins/woocommerce/includes/class-wc-data-store.php(159): WC_Product_Data_Store_CPT->read(Object(WC_Product))
#1 /data/web/theherbsplace.com/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(135): WC_Data_Store->read(Object(WC_Product))
#2 /data/web/theherbsplace.com/wp-content/themes/flatsome-child/functions.php(411): WC_Product->__construct('1440')
#3 /data/web/theherbsplace.com/wp-includes/shortcodes.php(325): cs_product_image_callback(Array, '', 'cs_product_imag...')
#4 [internal function]: do_shortcode_tag(Array)
#5 /data/web/theherbsplace.com/wp-includes/shortcodes.php(199): preg_replace_callback('/\\[(\\[?)(cs_pro...', 'do_shortcode_ta...', '[cs_product_ima...')
#6 /data/web/theherbsplace.com/wp-content/plugins/wordpress-seo/admin/ajax/class-shortcode-filter.php(35): in /data/web/theherbsplace.com/wp-content/plugins/woocommerce/includes/data-stores/class-wc-product-data-store-cpt.php on line 163

Open in new window


I don't understand how to fix the problem so please help.

Thanks,
0
image sizing and drop shadow is going a little odd here. This has a good drop shadow but the image is fuzzy as it's being scaled up.
http://mantex.technojeeves.com/index.html@p=49549.html

This one has the exact opposite
http://mantex.technojeeves.com/index.html@p=49605.html

I want to get the best of both worlds but don't know what's going on

NB this site is a temporary WP installation made static
0
Need Podcast options vs. WordPress...

I was considering making a WordPress site and getting a podcast plug-in so that I would have some advanced features.

I have plans to create MP3's, but found many platforms for the simple stuff, like that.

In addition, I would like:

- URL's and/or images associated with each episode
- I need outreach to be pretty easy, so I can communicate with people who follow my podcast
- I have seen other podcasts that once you enroll, the podcast notifies you for various outbound marketing events, like a new episode.
- SEO

What is the name of this type of browser configuration? Once, I had been notified much too often, and un-enrolled. I did this from the browser, I think it was on the Advanced page.

So, please refresh my memory on that, and tell me what podcast solutions provide this.

OR, do I need to make my own WordPress site and get several plug-ins for all this?

Thanks
0
Backing up a WordPress site to Bitbucket

I have a brand new WP site at A2 Hosting and hope to back up the site in its pristine condition, as my first code commit. That lets me easily see what changes I have made, and help me in the I changed something I should not have changed.

What parts of a WP site get backed up?

What parts of a WP site DO NOT get backed up?

How do you suggest I approach this...A2 Hosting > BitBucket?

Thanks
0
http://mantex.technojeeves.com/index.html@p=49591.html is the page in question. This site, temporary, has been produced by spidering a WP site, so we've effectively got a WooCommerce page made into static html. I'm mystified as to why the product image is not showing. Can you help?
0
Wordpress Gutenberg editor has an Image-Gallery editor based on Javascript that manages uploads, inserts, and how the gallery is provided. Does anybody know if there is something similar we could use for our own CMS?gallery.pdf

Thanks a lot.
0
Hi Experts,

My question is for my own website www.aces-project.com in particular the featured images.

I am using WP Appointment theme, and the original height of the featured image was around 550px, which was too big. I reduced it, but now some of the images are dis-proportioned. How can I find a happy middle for all screen sizes and devices? Also noting that on my Home slider, I have written span.

I have inspected other websites and see that they use the Featured Image as div background, opposed to  using the img tag.  I could overwrite the header.php in my child theme, but how do I make sure that the background shows the center of the image? Do all images need to be a certain or equal width/height? Is there any other considerations that I need to be aware of?

Any advise would be appreciated.
0
Hello,

I have a Wordpress menu, it is a 3 level menu and the third level isn't working properly.

If you visit this link.
http://oalaca.nextmp.net/

Under the profession menu you will see What is Landscape Architecture, the next 3 menu items  ( Why is Landscape Architecture Important?, and  Studying Landscape Architecture only appear when  What Does a Landscape Architect Do) are supposed to only appear when you hover over What is Landscape Architecture?, but they display as default...  

Interesting thing, if I go and scroll over that item and and then scroll off, those 3 menu items close and everything works as it should.

So my question is
1. How do i make What Does a Landscape Architect Do?, Why is Landscape Architecture Important?, and  Studying Landscape Architecture only appear when  What Does a Landscape Architect Do is hovered over?
0
Hi, Search Console is showing:

Hacked: Content injection
Description
These pages appear to be modified by a hacker in order to spam search results. Learn more
Sample URLs
May 20, 2019
http://blog.magickitchen.com/page/13/

First thing I'll do is make it SSL, I've been putting that off.

But Google says, use Fetch as Google, then they don't have that tool anymore. Typical.

They also show: Use cURL or Wget to fetch a page, but those look complicated. Does anyone here have those, and could maybe give me a tip about where the content is? I honestyl think that we have a link to somewhere that Google sees as a hack, but I don't think we were hacked.
0
Hi

I think my .io game might benefit from the main landing page being a blog / sign-in
before playing, so my gamers need an account to participate in contests that I'm anticipating.
Players will be able to practice, no matter what.
Will I be able to plug a Wordpress account / logins/ features into my game?
The account will be needed for participant info. I can also pop in ads on the blog aspect.

Would Wordpress be okay for this?

Thanks
0
Hello,

I feel with every update my word press page gets moved out of alignment.   All of the sudden on my mobile everything is pushed to the right, but it looks perfect on a PC. Can someone please assist?  See attached for what the page looks like on a mobile phone. Home page looks good its all my pages with posts that do not. The example is on:
http://wise-eats.com/podcastclips/website example
0
I am outputting all custom post type names, parents and children of those parents but I want the children to be nested within the parent in a list item. Currently they are all outputted at the same level in the current taxonomy.

  <?php $custom_terms = get_the_terms( $post->ID, 'product_cats' ); ?>
   <ul id="nav">
      <?php foreach($custom_terms as $custom_term) {
         wp_reset_query();
            $args = array(
                'post_type' => 'products',
                'numberposts' => '-1',
                'posts_per_page' => -1,
                'orderby' => 'name',
                'tax_query' => array(
                    array(
                        'taxonomy' => 'product_cats',
                        'field' => 'slug',
                        'numberposts' => '-1',
                        'posts_per_page' => -1,
                        'orderby' => 'name',
                        'terms' => $custom_term->slug,
                    ),
                ),
            );

         $loop = new WP_Query($args);
         if($loop->have_posts()) {

         $current_id = get_the_ID();
         while($loop->have_posts()) : $loop->the_post(); if($post->ID!=97){ ?>
      <li<?php if($current_id == $post->ID){?> class="current" <?php } ?> >
         <a href="<?php echo get_permalink();?>"><?php echo get_the_title();?></a>
      </li>
      <?php }  endwhile;
         }
         }

         wp_reset_postdata(); 

         ?> 

Open in new window


So, the output should look something like:

Item 1
Item 2
      Child 1
      Child 2
Item 3
Item 4
0
Is mixed content causing 403 Forbidden You don't have permission to access /weekly-rides/ on this server?   Our club recently installed an SSL Cert on their website.  Searching Google for Prairie Cycle Club now shows links that end up as for example:  "Forbidden You don't have permission to access /weekly-rides/ on this server."  When the URL is typed in directly, the page will display.  Other than needing to fix image URL's to avoid mixed content, what else can cause this 403 error?  Potentially the .htaccess needing an edit or rebuild?  This is a wordpress site and I'm not the admin, just a club member with an EE account.  Other clues, seems like maybe a redirect needs to be added to the .htaccess since www.prairiecycleclub.org yields Not Secure whereas https://www.prairiecycleclub.org yields "circle w/i" to indicate mixed content.   They said this started a couple weeks ago.  I noticed the cert date is May 1, 2019.
0
I have used this code here:

https://codex.buddypress.org/developer/loops-reference/the-members-loop/

and I want to filter users by certain criteria. The example for the bp-custom page is:

function my_custom_ids( $field_name, $field_value = '' ) {

  if ( empty( $field_name ) )
    return '';

  global $wpdb;

  $field_id = xprofile_get_field_id_from_name( $field_name ); 

  if ( !empty( $field_id ) ) 
    $query = "SELECT user_id FROM " . $wpdb->prefix . "bp_xprofile_data WHERE field_id = " . $field_id;
  else
   return '';

  if ( $field_value != '' ) 
    $query .= " AND value LIKE '%" . $field_value . "%'";
      /* 
      LIKE is slow. If you're sure the value has not been serialized, you can do this:
      $query .= " AND value = '" . $field_value . "'";
      */

  $custom_ids = $wpdb->get_col( $query );

  if ( !empty( $custom_ids ) ) {
    // convert the array to a csv string
    $custom_ids_str = 'include=' . implode(",", $custom_ids);
    return $custom_ids_str;
  }
  else
   return '';

}

Open in new window


Example Usage: Get all members who have filled out the xprofile field ‘dogs’ and selected the value ‘poodles’.

<?php if ( bp_has_members( my_custom_ids( 'dogs', 'poodles' ) ) ) : ?>

Open in new window

How do I add more conditions to the dogs/poodles. What If I also want 'birds', 'parrot' as well as 'dogs', 'poodles' ?
0
Hi there,

I have an issue with my woocommerce mini cart.

The issue I have is that there are a few items that seem to be stuck in the cart no matter if you are logged in or not. If you try and remove them, a few seconds later they appear again.

I thought It might have been outdated plugins and template files, so I have backed up my site and updated everything along with all the template files, still the same issue.

My website is www.ingeniousgifts.co.uk and you can access the slide out mini cart from the top right of the screen.

I have attached a screen record so you can see what happens.

I would really appreciate if someone could help me find out why this is happening and how to fix it?
Home---Ingenious-Gifts.webm
0
All of the sudden my posts do not show up properly and my navigation drops and you cant see it. I am a novice at WordPress, can someone please assist? The posts are all on the default template set up, which is what I have always used. The facts its affecting every page (other than the home page) makes me feel a setting is off.  Can someone please check out the site and advise?  Thank you!!

**UPDATE I figured out the posts but my navigation isnt showing in the proper spot on all pages except the home page like it use to. Is it maybe too many words?
wise-eats.com
0
Hi,

I would like to replace a plugin function with my own as I want to customise the frontend structure

Here is the function I am wanting to replace...

/**
 * Get row action for product
 *
 * @since 2.7.3
 *
 * @param object $post
 *
 * @return array
 */
function dokan_product_get_row_action( $post ) {

    if ( empty( $post->ID ) ) {
        return array();
    }

    $row_action      = array();
    $row_action_html = array();
    $product_id      = $post->ID;

    if ( current_user_can( 'dokan_edit_product' ) ) {
        $row_action['edit'] = array(
            'title' => __( 'Edit', 'dokan-lite' ),
            'url'   => dokan_edit_product_url( $product_id ),
            'class' => 'edit',
        );
    }

    if ( current_user_can( 'dokan_delete_product' ) ) {
        $row_action['delete'] = array(
            'title' => __( 'Delete Permanently', 'dokan-lite' ),
            'url'   => wp_nonce_url( add_query_arg( array( 'action' => 'dokan-delete-product', 'product_id' => $product_id ), dokan_get_navigation_url('products') ), 'dokan-delete-product' ),
            'class' => 'delete',
            'other' => 'onclick="return confirm( \'Are you sure?\' );"',
        );
    }

    if ( current_user_can( 'dokan_view_product' ) && $post->post_status != 'pending' ) {
        $row_action['view'] = array(
            'title' => __( 'View', 'dokan-lite' ),
            'url'   => get_permalink( $product_id ),
            'class' => 'view',
        );
    }

    

Open in new window

0
WordPress and WooCommerce.  Does anyone have an idea on how to accomplish the following.  If a customer signs up for an account on an online store they can pick from a drop down menu of what organization they belong to.  Once registered they can see pages that are in a specific category.  If you are not registered as that type of user you can not see those pages.

Any suggestions?
0
this is a  follow-on to this question
https://www.experts-exchange.com/questions/29145248/Need-Custom-Short-Code-For-WooCommerce.html

Open in new window


The image is too large to be useful.  So, is there any way to programmatically create a short-code that does everything in the previous question but uses a thumbnail instead?

I found this
https://wordpress.stackexchange.com/questions/235313/add-the-post-thumbnail-url-to-a-shortcode-in-function-php

Open in new window

but I am not clear how to design what I need.
0
I'm trying to incorporate Ajax Live Search in a custom WordPress plugin.
I have copied the necessary files into a subdirectory of my plugin, and followed the readme file instructions to set the variables and work the plugin into the site.
I get stuck on point 5 however, which reads like this:

5. Make sure `core/Handler.php` and `core/Config.php` are included in your (PHP) page and you have these lines at the very top of the file (Check `index.php`):

	```
    use AjaxLiveSearch\core\Config;
    use AjaxLiveSearch\core\Handler;
    
    if (session_id() == '') {
        session_start();
    }
    
    $handler = new Handler();
    $handler->getJavascriptAntiBot();

Open in new window


So I have put an include statement at the top of a custom template php file in my theme for Config.php and Handler.php like this:

 include plugins_url().'/my_plugin/AjaxLiveSearch/core/Handler.php';
 include plugins_url().'/my_plugin/AjaxLiveSearch/core/Config.php';

Open in new window


So far so good... although if I try using require_once instead of include, as it does in the attached example index.php (supplied by Ajax Live Search), WordPress throws an error.

I'm not familiar with the 'use' statement in php so I'm not sure whether (nor how) to modify the paths it gives.  That means that when I try calling the Handler class, with
$handler = new Handler();

Open in new window

... it causes a site error, presumably because it can't find it...?

So my question is - how can I reference the Handler class from my template file (from the theme directory of a WordPress installation), when the class resides in Handler.php which is in a subdirectory of my plugin folder: ie plugins_url(). '/my_plugin/AjaxLiveSearch/Handler.php ...?

Can someone give me what the php 'use' statement should be in this context (as per lines 2 & 3 of the first code sample) ?
0
I need a shortcode for WooCommerce 3.6.2 that will show the image, price and add to cart button.  I found this shortcode [add_to_cart id="1984"] but it only shows the following:

https://gyazo.com/c1efad0e35b85a05227db4941ff6cd62

I saw this
https://stackoverflow.com/questions/19930779/woocommerce-custom-shortcodes

Open in new window

discussing how to do a custom shortcode via php.  I know some php but I am not that clear how to create what I am needing.

Thanks,
0
I have the following line inside of an iframe on a wordpress site.

https://docs.google.com/spreadsheets/d/e/2PACX-1vT-H868DBGiALD6aLAbtvx23tU1IQyCi-FUHXVb76lgf0zV0fP8AGwyGK-1qU_n6rvLP4LfXcjMq1dx/pubhtml?gid=374627540&single=true

Open in new window


Is there a way within the syntax of the above code to keep some columns from showing on the page, but still allow me to edit them from within Google Drive?

Note that I don't want to hide them, even temporarily within google drive itself, but only to viewers of the page within the context of the iframe.
0
Hi,

I am customising a function in my dokan multivendor plugin for the store coupons. I can successfully add in what I need to but when it comes to removing the original action, it doesn't seem to work. So it's displaying both of them, a duplicate of the function I am trying to modify. You can see a screenshot attached of the duplicate results clearly marked and my code below is what I am using in my functions.php file.

The function version is the one I want to keep.


add_action('dokan_store_profile_frame_after','ig_show_store_coupons');
function ig_show_store_coupons( $store_user, $store_info ) {
	
	
	
        $seller_coupons = dokan_get_seller_coupon( $store_user->ID, true );

        // var_dump( $seller_coupons );
        if ( ! $seller_coupons ) {
            return;
        }
        // WC 3.0 compatibility
        if ( class_exists( 'WC_DateTime' ) ) {
            $current_time = new WC_DateTime();
            $current_time = $current_time->getTimestamp();
        } else {
            $current_time = current_time( 'timestamp' );
        }
		echo '<h3 class="widget-title">Coupons/Offers</h3>';
        echo '<div class="store-coupon-wrap">';

        foreach ( $seller_coupons as $coupon ) {
            $coup = new WC_Coupon( $coupon->ID );

            $expiry_date = dokan_get_prop( $coup, 'expiry_date', 'get_date_expires' );
            $coup_exists = dokan_get_prop( $coup, 'exists', 'is_valid' );

            if ( class_exists( 'WC_DateTime' ) && 

Open in new window

0
WordPress and Azure?

I hope to create a WP site as a hobby, since I just never got around to learning PHP. But, as a .NET Developer, I also want to get my hands dirty with Azure.

Does it make sense to do this? Eventually, I would expect to host the WP site, but have no idea of what it might cost to so this. I mean, host WP on Azure.

Any idea what it might cost for a low-traffic WP podcast hosted on Azure?

Or, if this is a really bad idea, please tell me.

Thanks
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.