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

WooCommerce / WordPress over ride a Plugin function.  I always seem to run into trouble when I try to over ride a plugin function. I have a plugin that makes a Woo Product category password protected.  It is an open source plugin from GIT.  I want to customize the password form.  The form is in a function inside the functions.php file of the plugin.
The Plugin Method
<?php
function wcl_get_the_password_form($category_id = false)
{
//  DO STUFF
}

Open in new window


My Method inside of my child theme functions.php:
<?php
add_action('wcl_get_the_password_form','mogo_password_form');

function mogo_password_form($category_id = false)
{
//  DO STUFF
}

Open in new window


This is the Plugin link: https://wordpress.org/plugins/wc-category-locker/
0
OWASP: Avoiding Hacker Tricks
LVL 13
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

I am trying to create a query that pulls the menu structure for the primary menu in a WP site so that we can use it in an outside app without having to make sure that the menu stays up-to-date.  

This query works fine except that it only pulls custom links and not pages that are in the menu.  meta_value 579 is this particular submenu.  Any ideas on what I am missing for this?

SELECT p.id, post_title, guid, meta_key, meta_value, (select meta_value from wp_postmeta where post_id = p.id and meta_key = '_menu_item_url') as linkurl FROM wp_posts AS p LEFT JOIN wp_term_relationships AS tr ON tr.object_id = p.ID LEFT JOIN wp_term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id LEFT JOIN wp_postmeta AS pm ON pm.post_id = p.id WHERE p.post_type = 'nav_menu_item' AND tt.term_id = 2 and post_title != '' and post_status = 'Publish' and meta_key = '_menu_item_menu_item_parent' and meta_value = '579' order by menu_order

Open in new window

0
I want to show all blog categories that aren't of type gallery. My code almost works but if I have 2 posts in the same category the category is shown twice ie:

If I create a category called 'news' and add 2 non-gallery posts, it shows up as:

news
news

instead of just

news

<?php 
   $galleryPosts = new WP_Query(array(
       'post_type' => 'post',
       'order' => 'ASC'
   ));
   ?>
<?php if ( $galleryPosts->have_posts() ) : ?>
<?php while ( $galleryPosts->have_posts() ) : $galleryPosts->the_post(); ?>
<?php if(!has_post_format('gallery')) {
   the_category();
   }

   ?>
<?php endwhile; ?>
<?php endif; ?>

Open in new window



I tried this as well:

         <?php 
                $galleryPosts = new WP_Query(array(
                    'post_type' => 'post',
                    'order' => 'ASC'
                ));
                ?>

         <?php if ( $galleryPosts->have_posts() ): ?>
         <?php while ( $galleryPosts->have_posts() ): ?>
           
                <?php if(!has_post_format('gallery')) {
                            $galleryPosts->the_post();
                            the_category();
                        }
    
                ?>
                
          <?php endwhile; ?>
          <?php endif; ?>

Open in new window


But that just resulted in an infinite loop.
0
I am running wordpress 5.1.1 and WooCommerce 3.6.1 on a LInux 2 Amazon instance and I had a message that my db needed to be updated for WooCommerce. I opted to begin the process and this message popped up.

WooCommerce database update – WooCommerce is updating the database in the background. The database update process may take a little while, so please be patient. 

Open in new window


This message has been up for 24 hours now and I have a small store of 1400 sku's.

I have attempted the following:
1. restarted maria
2.  deactivated and activated woocommerce
3. checked the memory in wp-config which is set at 1024 MB
4. restarted Apache

How can I get rid of this message?  If the message isn't a problem how can I be assured the db integrity is intact?

Thanks,
0
I want to create galleries using a normal Wordpress post. But Those are showing up on the main blog page because they are obviously also posts even though I just have standard Gutenberg galleries inside.

I added this to my functions file to prevent posts from this particular category from showing up in the blog:

function exclude_category( $query ) {
  if ( $query->is_home() && $query->is_main_query() ) {
        $query->set( 'cat', '-38' );
        }
  }
add_action( 'pre_get_posts', 'exclude_category' );

Open in new window


But the categories are still showing up where I list the categories when I don't want them to:

<?php $cats = get_categories(); ?>
        <?php foreach($cats as $cat): ?>
             <a href="#" class="button"><?php echo $cat->name; ?></a>
        <?php endforeach; ?>

Open in new window


It seems like a lot of work to try exclude this category and if it is deleted and recreated the ID will change and the code will break. Is there a standard way around this or would it be better to just create a custom post type?
0
For normal posts I would just use
<?php echo paginate_links(); ?>

Open in new window

but life isn't so easy with custom post types. Is the only way to create function to do it like this?

function custom_pagination($numpages = '', $pagerange = '', $paged='') {
 
    if (empty($pagerange)) {
        $pagerange = 2;
    }
 
    global $paged;
     
    if (empty($paged)) {
        $paged = 1;
    }
     
    if ($numpages == '') {
        global $wp_query;
         
        $numpages = $wp_query->max_num_pages;
         
        if(!$numpages) {
            $numpages = 1;
        }
    }
 
    $pagination_args = array(
        'base'            => get_pagenum_link(1) . '%_%',
        'format'          => 'page/%#%',
        'total'           => $numpages,
        'current'         => $paged,
        'show_all'        => False,
        'end_size'        => 1,
        'mid_size'        => $pagerange,
        'prev_next'       => True,
        'prev_text'       => __('&laquo;'),
        'next_text'       => __('&raquo;'),
        'type'            => 'plain',
        'add_args'        => false,
        'add_fragment'    => ''
    );
 
    $paginate_links = paginate_links($pagination_args);
 
    if ($paginate_links) {
        echo  $paginate_links; 
    }
}

Open in new window


And then call that function on the page where you need pagination?
0
Hello,  I'm having a litle trouble with the CSS on our location map.  I'm using the WP Google Maps Pro, and had an update. Now if you click on any of the locations, the popup is all squashed together.  

How can i target just the popups, so they are formatted nicely?

Here is the website
0
Hi,

I am in trouble running a WordPress site on Bitnami WordPress on ec2 instance.

It seems that apache is running, but no http response from the server.
Port 80 is not listened by any service.

bitnami@ip-:~$ lsof -i # no output
bitnami@ip-:~$ 

Open in new window


Apache seems to be runnning.
bitnami@ip-172-31-33-101:~$ ps aux | grep apache
root      1910  0.0  2.9 203384 30288 ?        Ss   07:35   0:00 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
daemon    1915  0.0  1.5 812444 15968 ?        Sl   07:35   0:00 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
daemon    1916  0.0  1.5 812444 15892 ?        Sl   07:35   0:00 /opt/bitnami/apache2/bin/httpd.bin -f /opt/bitnami/apache2/conf/httpd.conf
bitnami   2996  0.0  0.1  14224  1084 pts/1    S+   07:37   0:00 grep --color=auto apache

Open in new window


I restarted apache, mysql, php as follows.
bitnami@ip-172-31-33-101:~$ sudo /opt/bitnami/ctlscript.sh start
/opt/bitnami/mysql/scripts/ctl.sh : mysql  started at port 3306
/opt/bitnami/php/scripts/ctl.sh : php-fpm started
Syntax OK
/opt/bitnami/apache2/scripts/ctl.sh : httpd started at port 80

Open in new window


But no response.

bitnami@ip-172-31-33-101:~$ curl localhost:80

Open in new window


Any advise would be very appreciated.

Thanks!
0
WordPress backup software recommendations.
Have a customer using Wordpress and none of the backup pluigins seem to be working.

Neither Backup Guard or BackUpWordPress work.

Any ones that actually work?
0
I am trying to pass a variable in a WordPress form to Paypay.  Even though I can display the variable on the screen, I can not get it to pass over to PayPal via the script.  If I put in a constant, I have no problem.  Is there a way to pass my variable {Total:13} into PayPal. Or set it to a variable that I can pass.

Below is the script that works with a constant in the amount line.  How can I change the "34.00" to the variable {Total:13}?

<input name="business" type="hidden" value="XXXXX@XXXXXX.com" />
<input name="currency_code" type="hidden" value="USD" />
<input name="item_name" type="hidden" value="/" />
<input name="amount" type="hidden" value="34.00" />
<input name="rm" type="hidden" value="2" />
0
Exploring SQL Server 2016: Fundamentals
LVL 13
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Hi,

I was customising a banner on my client's homepage around a week ago, very basic additional CSS on a qode wordpress theme to get the banner looking the way I wanted, achieved that, saved my work and closed my laptop down.

When I got home a short while later, I visited her site on Firefox and the homepage was a mess! Her logo was gone and the theme logo was in its place, the buttons on her homepage had lost all their styling, the banner I was impressed with looked awful and not like the final version I saved, the footer columns widget content had all shifted out of alignment to the left as well as various other styling issues.

I know this is clearly CSS related but error logs are referencing PHP issues, nothing mentioned about CSS and PHP is something I know absolutely nothing about. I've copied and pasted some of the errors and spent some time trying to figure out what they mean but her site has been like this for too long now for me to learn enough PHP to understand these errors and determine whether they could be related to my issue.

Out of desperation, I deleted my theme and reinstalled as I had similar issues following a major update recently and hoped following those steps might solve the problem this time, but no luck.

If anyone has the time and understanding of PHP to scan through my error codes and tell me whether or not this could be related to the problems I've had I would be extremely grateful...

The PHP version is: 5.6.30, Wordpress 5.1.1, …
0
this is a follow-on to this question
https://www.experts-exchange.com/questions/29142368/Need-Help-With-WooCommerce-Custom-Sort.html

Open in new window

I need to have a multiple layer sort.  I now have it sorting on Parent ID but then I need within the the Parent ID for it to be alphabetical.  For example, I have a $2 Off, Buy 4 and a Buy 9.  They need to be in that order but now they are Buy 9, Buy 4 and $2.  I know I can do menu order but that is another tedious task.

If someone can show me how in the code below to do a sort on Alphabetical within Parent ID that would be great.

[code]unction jk_add_custom_sku() {
$args = array(
'label' => __( 'Parent ID', 'woocommerce' ),
'placeholder' => __( 'Enter custom SKU here', 'woocommerce' ),
'id' => 'jk_sku',
'desc_tip' => true,
'description' => __( 'This SKU is for internal use only.', 'woocommerce' ),
);
woocommerce_wp_text_input( $args );
}
add_action( "woocommerce_product_options_sku", "jk_add_custom_sku" );

function jk_save_custom_sku( $post_id ) {
// grab the custom SKU from $_POST
$custom_sku = isset( $_POST[ 'jk_sku' ] ) ? sanitize_text_field( $_POST[ 'jk_sku' ] ) : '';

// grab the product
$product = wc_get_product( $post_id );

// save the custom SKU using WooCommerce built-in functions
$product->update_meta_data( 'jk_sku', $custom_sku );
$product->save();
}

add_action( "woocommerce_process_product_meta", "jk_save_custom_sku" );
//add_action( "save_post_product", "jk_save_custom_sku" );

####### Custom Sort Option

Open in new window

0
Hi,

My competitor has a recurring subscription service which you can see below - the user can either click no subscription or if they click a subscription recurring they get to choose from a drop down:

https://us.brushnaked.com/collections/adult-toothbrushes/products/adult-soft-activated-charcoal-bristle-toothbrush

I would like the same layout/style on my site you can see how it is now below:

https://staging1.barebrush.com.au/product/bio-toothbrush/

Here is the code for that part of the page (note I am using the Subscribe All Things Master plugin (https://github.com/somewherewarm/woocommerce-subscribe-all-the-things) and this is one of the template pages):

https://gist.github.com/HeadStudios/3f03286f1672d271d7cb96fd3a8db6fe

Any input you could give on functions/CSS styles to use and the overall view of how to approach it would be much appreciated.

Thanks
0
I know I can add theme version number as query string to my style sheet like below

$child_theme_url = get_stylesheet_directory_uri();
$theme_num = wp_get_theme()->get('Version');
wp_register_style( 'avia-style' ,  $child_theme_url."/style.css", array(), $theme_num, 'all' );

Open in new window


How to do the same for all img tags so they can be like below

<img src="/myimage.jpg?v=1.0.2" alt="" />

Open in new window


Thanks
1
Okay. Here's what I have:

A user dashboard where a logged in user can publish, delete and draft posts that they have authored.

 Member-Dashboard---Cazooz-SB-3.jpg
When a post is Deactivated it is moved over under the Inactive tab.

Member-Dashboard---Cazooz-SB-2.jpg
My big issue: I pretty much suck at Javascript. I thought it could be Ajax, however, I'm avoiding that in lieu of just old school page refresh.

I don't feel I need that checkbox as well as Deactivate button. Those are dregs left over from my Ajax attempt.

I don't even know where to begin on this. So, I apologize for my greenery!

Can someone give me direction?
0
i am working on a muilt network wordpress site that when the user signs in the site is created. i have it that the site will create and change the theme. what i need is to run woocommerce after creating the site.
0
Hi There

I have a client who sells time slots for his his business in many different locations. Up until now there has never been any issues because the customer would have to go to their website to start booking an appointment. It is a WordPress site using the Bookings extension with WooCommerce.

However, they are now going to be working with a Hotel that will be sending them some clients, and we will need to monitor the bookings being made.

Is there software/plugins/scripts that will allow a code to be added to the URL which will follow a button clicked on their website through to a booking being made???

We need some way of tracking any bookings being made which originate from the Hotel website.

regards
0
Hello, I am adding a donation page to a WordPress website I am working on. I want the visitors to be able to go to this page and have a few options such as $25, $50, $100 buttons and a field to input the amount they desire to donate if they prefer more or less. My question is I prefer to keep the person within the webpage and not taking away to a portal to make the donation. I was thinking pay pal but wanted to get some feedback from you guys before I just go with Paypal. Are there any services / add ons that you prefer when incorporating something like this into WordPress?
0
Hi guys, we are using this feed here to be then imported by our mobile apps, https://nova.ie/feed however it is displaying two images within the body, is there anyway that it doesnt show the image within the body.

To get this working yesterday i put this code into functions.php on Wordpress

?php

function featuredtoRSS($content) {
global $post;
if ( has_post_thumbnail( $post->ID ) ){
$content = '<div>' . get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'margin-bottom: 15px;' ) ) . '</div>' . $content;
}
return $content;
}
 
add_filter('the_excerpt_rss', 'featuredtoRSS');
add_filter('the_content_feed', 'featuredtoRSS');

Open in new window

0
Introduction to R
LVL 13
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

I don't figure out how to make a Pagination plugin work properly

Purpose:
I want to create a post list page, where all posts are displayed. This page will have pagination at footer.
To implement pagination, I installed WP-PageNavi plugin.
https://wordpress.org/plugins/wp-pagenavi/#description

Current Situation:
- According to sample code shown above, I put the line in the code to show pagination, but it does not show.
 <?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>  

Open in new window


What am I missing?

Codes to generate post list come before the pagination.

Whole code: post-list.php
/* Post list generation - START*/
<?php
$paged = (int) get_query_var('paged');
$args = array(
        'posts_per_page' => 10,
        'paged' => $paged,
        'orderby' => 'post_date',
        'order' => 'DESC',
        'post_type' => 'post',
        'post_status' => 'publish'
);
$the_query = new WP_Query($args);
if ( $the_query->have_posts() ) :
        while ( $the_query->have_posts() ) : $the_query->the_post();
?>
        <div class="news-item">
          <div>
            <a href="#" class="news-item-title"><?php the_title(); ?></a>
            <p class="news-item-desc"><?php the_excerpt(); ?></p>
            <a class="more-link" href="<?php the_permaLink(); ?>">Read more</a>
          </div>
        </div>

/* Pagination here */
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?> 
<?php endwhile; endif; ?>

<?php wp_reset_postdata(); ?>

<?php
get_footer();

Open in new window


Preview site: http://54.178.243.12/%E3%83%8B%E3%83%A5%E3%83%BC%E3%82%B9%E4%B8%80%E8%A6%A7/

Any advice would be very appreciated.
0
I am having a couple of issues with a WordPress site, and think that they are because of either the theme, or the fact that I moved some files from directory to directory and something got corrupted... The website is www.thehandlebarredhealer.com

First - The first issue is that quite often when I am editing pages or working from the dashboard, there is a brief moment in the upper-left hand corner of the screen when some text appears that says "Search a icon", and "loading" - please see this video and watch the red area in the upper-left corner healer-theme.wmv.  Also whenever I print a report from Formidable Forms, the same image of "Search a icon" appears in printed reports.  Please advise as to how to fix this problem.

Second - There is a gap that I find too large between the social media icons in the header and the blog title.  Any solutions as to how to tighten up that space would be appreciated.
0
Hi ,

I have a slider through a widget using the following page sample in my Wordpress website. which was working before but now it is not for some reason
It is worth mentioning, I am using Pods framework to sotre custom fields.

https://imageslidermaker.com/v2  -  Slider JS code taken from here and pasted into the wp-content

Below is the code added in the widget:
<div class="ism-slider" data-play_type="loop" id="my-slider">
<ol>
[each horse_image]
   <li>
     <img src="{@horse_image._src.large}">      
   </li>
[/each]
</ol>
</div>

Open in new window




page trying to display the image
https://www.ttsc.com.au/horse/sample-horse-2/
0
Plugin causing the server to crash.

Hi guys, i have a plugin that seems to be causing the server to crash. Its on this site https:/www.nova.ie so basically

wp-content/plugins/modus-radio-station/pages/frontclass.php line 346 it seems to be calling wp-load for every piece of audio on this page

https://www.nova.ie/listen-back-favourite-shows/

so i dont know what the best way to go about it is.
0
How do Upgrade JQuery on a WordPress Site, Theme called Bee?

Will that happen automatically if I upgrade the theme to the latest version.

Thanks
0
Hello,

I have two forms using gravity forms plugin for wordpress.

When I submit the first form I want it to check/validate a field from another forms entries and if it does not exist redirect the user to that other form.

Checking another forms entry seems easy enough using gform_field_validation, but I'm not really sure how to have it redirect

Alternatively -- which might be easier -- all i would need is for a box to be checked or a field to have a value based on that validation -- ie:  if value exists in entry of another form then check box or return "yes" (depending on field type) -- then I can use the built-in tools for redirection based on that field.

As you can see im not super technical, however, i am well versed on wordpress and front end gravity forms stuff
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.