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

Hello and thanks in advance for any insight the community can provide. I'm working on a WordPress site hosted on GoDaddy's Business Launch Hosting Plan, so it's a Linux  environment.  The challenge I have is with trying to use a SQL query to display data from an external MS SQL server to the WordPress site.
 
When I started looking into this, I wanted to use a plugin (WPDataTable) to do this. I cleared one error when trying to connect to the server by enabling pdo_sqlsvr. Then I received the following error:

wpDataTables could not connect to mssql server. mssql said: There was a problem with your SQL connection - SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 13 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 13 for SQL Server for x64: http://go.microsoft.com/fwlink/?LinkId=163712

I called GoDaddy to see how to resolve the error. They said our website would need to be hosted in their Windows environment (Plesk) in order to communicate with a MS SQL server, otherwise, I'd have to export data from MS SQL to i.e., CSV to then import to MySQL.

- Someone today (not godaddy) said there's potentially an option if I had root access to set up Microsoft’s freetds configuration, which I'm pretty sure I don't have through Godaddy (we're not on the VPS hosting plan) and this goes beyond my level of expertise.
- I'm assuming that whether attempting to do this with a plugin, or writing code, MS SQL server…
0
Can anyone recommend a Wordpress plugin or combination of plugins that would do the following preferably using gravity forms and possibly as free or cheap as possible :)

- When a form is filled out on the front end it should email the website owner
- it should store the record in the database and create a 'ticket' for that request that can be replied to from the Wordpress backend. The user does not need an account to submit the form and the tickets will only be for the site administrator
- automated follow up emails to be sent to the person who filled out the form at set intervals until the ticket is closed
0
Hello, As the title states, I am tying to list the taxonomy categories for a specific custom post type created by this plugin, here is my code so far, no luck.


    <select name="event-dropdown" onchange='document.location.href=this.options[this.selectedIndex].value;'> 
    <option value=""><?php echo esc_attr(__('Select Category')); ?></option> 

    <?php 
        $option = '<option value="' . get_option('home') . '/category/">All Categories</option>'; // change category to your custom page slug
        $categories = get_categories( array(
			'orderby' => 'name',
			'order'   => 'ASC',
			'taxonomy' => 'firm_type'
		) );
		
        foreach ($categories as $category) {
            $option .= '<option value="'.get_option('home').'/category/'.$category->slug.'">';
            $option .= $category->cat_name;
            $option .= ' ('.$category->category_count.')';
            $option .= '</option>';
        }
        echo $option;
    ?>
</select>

Open in new window

0
Hi there - I have an urgent issue which could lose me a customer if I don't get it resolved this evening. Hope someone is able to help with this.

I had a new CentOS 7 server built for a customer and have moved all their websites to it. They are all Wordpress sites and all (on the old server) used to use MySQL databases. It was a CentOS 6 server. The new server uses MariaDB which I believe works the same as MySQL.

One of the files on the site has this PHP code in it:

<?php
//      CONNECTION DETAILS
        $dataHost_EMO = 'localhost:3306';
        $dataUser_EMO = 'overall_emo_adm';
        $dataPass_EMO = '@1}Zq!!?6]M?_EMO';
        $database_EMO = "overall_emo";

//      Connect to MEMBERS DATABASE
        $connect_EMO = mysqli_connect( $dataHost_EMO, $dataUser_EMO, $dataPass_EMO, $database_EMO );
        if (!$connect_EMO) { die('Connection to db failed because... '.mysqli_error( $connect_EMO ) ); }
//      else { echo "Connected to MEMBERS DATABASE"; }

        // echo "project_emo/connection_for_emo.php HAS BEEN INCLUDED"; 
        // die("TESTING Connection");

?>

Open in new window

The error message "Connection to db failed because..." comes up. Head scratching moment.

I have made sure that the password matches the username in the config.php file and anywhere else I can find it, including in the above PHP code.

If anyone has a suggestion I would be so grateful!

Many thanks
Chris
0
I am showing child page titles as links but I want to have each word on a new line ie:

 Some 
Button

Open in new window


But it is showing as

Some Button

Open in new window


<?php
if ( $post->post_parent ) {
    $children = wp_list_pages( array(
        'title_li' => '',
        'child_of' => $post->post_parent,
        'echo'     => 0
    ) );
} else {
    $children = wp_list_pages( array(
        'title_li' => '',
        'child_of' => $post->ID,
        'echo'     => 0
    ) );
}
 
if ( $children ) : ?>
  
        <?php echo $children; ?>
   
<?php endif; ?>

Open in new window


I tried to do this with CSS in many different ways but it either didn't work at all or did not give me the exact result I wanted. I also thought to use php explode but $children is outputted as <li> and not an array as far as I can tell.

In case there is a css solution, the html output is:

<li class="page_item page-item-952">
     <a href="http://localhost:8888/myurl/myotherurl">Some Button</a>
</li>

Open in new window

0
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
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
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
I want to show different sidebars on different pages or somehow show the sidebars on each page when editing in the backend  so they can be selected from a dropdown perhaps. I don't know if this is baked into Wordpress and just needs some code in the page to enable it or if this is a more complex task. I don't want to use a plugin unless I really have to.

I had some conditional logic in the page at the moment but this is a bad idea because the pages can be deleted and recreated with a different ID etc.

     <?php 
    
        if($pageID === 18) {
            get_sidebar( 'sidebar-1' ); 
        } else if($pageID === 16 || $pageID === 68) {
            get_sidebar( 'sidebar-2' ); 
        } else {
            get_sidebar( 'sidebar-3' ); 
        }
        

     ?>

Open in new window

0
I have created a custom widget with fields from advanced custom fields. I just wanted to check that the code is okay or if it could be improved upon (I am sure it can be). I placed this in my functions.php file but don't think it belongs there either. Where would be a better place to put it?

class ACF_Custom_Widget extends WP_Widget {

    /**
    * Register widget with WordPress.
    */
    function __construct() {
        parent::__construct(
            'fair_deal_widget', // Base ID
            __('Fair Deal Widget', 'text_domain'), // Name
            array( 'description' => __( 'A fair deal widget', 'text_domain' ), 'classname' => 'fair-deal-widget' ) // Args
        );
    }

    /**
    * Front-end display of widget.
    *
    * @see WP_Widget::widget()
    *
    * @param array $args     Widget arguments.
    * @param array $instance Saved values from database.
    */
    public function widget( $args, $instance ) {
      // outputs the content of the widget
      if ( ! isset( $args['widget_id'] ) ) {
        $args['widget_id'] = $this->id;
      }
        
        $widget_id = 'widget_' . $args['widget_id'];

        $bgImage = get_field('background_image', $widget_id);
        $profilePic = get_field('profile_pic', $widget_id);
        $name = get_field('name', $widget_id);
        $description = get_field('description', $widget_id);
        $cta = get_field('call_to_action', $widget_id);
        $contactNum = get_field('contact_number', $widget_id);


   

Open in new window

0
I am needing to change the search url after I change the permalink assigned to my products.

I have a permalink situation on my products when I fix the permalink change.  The free version of wordpress search still shows the old url even purging the cache.  By the way, I have changed settings -> permalinks saved it and then put it back to my normal settings and saved it again.  All the while purging the cache.

Here is a screenshot

screenshot of all of the slugs for Skeletal Strength if you look at the last product in the slug I took away the "-8" hoping it would default to the correct slug.  However it still faults to the old content id 3276?.  I thought the normal url was supposed to default to the non appended -[number] option?

FYI I have to have separate sku's for each offer with the vendor I am using thus the reason for the numerous slugs being appended with various numbers.

If you want to look at the one of the products in question it is at
https://www.theherbsplace.com/product/skeletal-strength-p-535-8/

I have several products that have appended -numbers on their slug which is causing the search engine to bring up other product slugs instead of the product that is in stock and available for sale.
0
I am unable to use the featured image. My site is running WordPress 5.1.1. I have tried to use the “image” as shown in the attached screenshot, but I cannot find a featured image control. Please help.Post without Featured Image
0
I thought this would be super easy to do but I can't seem to find an easy way.

When I go to my blog page I want to list all the categories available in a custom layout, so I don't want to use a widget.

I did this:

    <?php wp_list_categories( array(
        'orderby' => 'name'
    ) ); ?> 

Open in new window


But the formatting is awful.

Then I tried this:

    <?php $cats = get_categories(); ?>
    <div class="blog">
        <a href="#" class="button blog-category">show all</a>
        <?php foreach($cats as $cat): ?>
        <a href="<?php echo site_url() . '/category/' . $cat->slug; ?>" class="button blog-category"><?php echo $cat->name; ?></a>
        <?php endforeach; ?>
    </div>

Open in new window


But not sure that href is ideal. And the other problem is that I want the category I am on to add an active class to the nav item.
0
Here's a screenshot of what I'm seeing on my Dashboard when I'm looking at a photo gallery using the "Responsive Photo Gallery Pro" plugin...

screenshot
Every thumbnail, every image is flawed because of the path looking for a folder called "georgia." That was the default folder on the old server. I've since migrated the site to a new server and "georgia" doesn't exist.

But...

The migration has been a total success with every other setting that I've seen thus far and every reference to "georgia" seems to have been eradicated from the database. Still, there's this reference to the "georgia" directory and I don't know where to go to change it.

I'm thinking there's a setting somewhere, but I've run out of ideas.

Any thoughts?
0
I need a sort that uses the parent id which is called jk_sku.  I am on 5.1.1 WordPress and 3.5.7 for WooCommerce.  I only need this as an option for sort.  So following two articles on the net.  I put together this code

function 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 ######################

// 1. Create new product filter
 
add_filter( 'woocommerce_get_catalog_ordering_args', 'bbloomer_sort_by_name_woocommerce_shop' );
 
function bbloomer_sort_by_name_woocommerce_shop( $args ) {
     
    $orderby_value = isset( $_GET['orderby'] ) ? wc_clean( (string) wp_unslash( $_GET['orderby'] ) ) : wc_clean( get_query_var( 'orderby' ) );
   

Open in new window

0
Hello,

i am trying to write an wordpress user search with multiple types of meta_query includes, some AND, some OR, but I am finding that they just replace each other

So in plain english, my default search search through first name, last name and description of a user, this works fine. But I also have a custom field for each user member_search_visibility, which tells me if they users wish to be found in search results, so if I add is as below, if ignores that names and only searches member_search_visibility (last few lines of code)

So how can i make my search go through all name data AND only display users who member_search_visibility is equal to yes

$args = array (
    //'role'       => 'reporter',
    'order'      => 'ASC',
    'orderby'    => 'display_name',
    //'search'     => '*' . esc_attr( $default_fields ) . '*',
    'meta_query' => array(
        'relation' => 'OR',
        array(
            'key'     => 'first_name',
            'value'   => $default_fields,
            'compare' => 'LIKE'
        ),
        array(
            'key'     => 'last_name',
            'value'   => $default_fields,
            'compare' => 'LIKE'
        ),
        array(
            'key'     => 'description',
            'value'   => $default_fields ,
            'compare' => 'LIKE'
        )
    ),
	'meta_query' => array(
        'relation' => 'AND',
        array(
            'key'     => 'member_search_visibility',
            'value'   => "yes" ,
            

Open in new window

0
Hello,

I am trying to build a custom Wordpress use search, it is displaying  every user and ignoring my search criteria

Search form  ( LINK: http://oalaca.nextmp.net/member-search/ )
<form role="search" method="get" class="search-form" action="http://oalaca.nextmp.net/member-search-results/">
	<label>
		<input type="search" class="search-field" placeholder="" value="" name="main_fields" title="">
	</label>
	<input type="submit" class="search-submit" value="Search Users">
</form>

Open in new window


Search results

        <?php 
	
	function myplugin_register_query_vars( $vars ) {
    $vars[] = 'main_fields';
    $vars[] = 'default_fields';
    return $vars;
}
add_filter( 'query_vars', 'myplugin_register_query_vars' );
	
	
	$default_fields = $_POST['main_fields'];
		
		
		// WP_User_Query arguments
$args = array (
 
    'order'      => 'ASC',
    'orderby'    => 'display_name',
    'search'     => '*' . esc_attr( $default_fields ) . '*',
    'meta_query' => array(
        'relation' => 'OR',
        array(
            'key'     => 'first_name',
            'value'   => $default_fields,
            'compare' => 'LIKE'
        ),
        array(
            'key'     => 'last_name',
            'value'   => $default_fields,
            'compare' => 'LIKE'
        ),
        array(
            'key'     => 'description',
            'value'   => $default_fields ,
            'compare' => 'LIKE'
        )
    )
);

// Create the WP_User_Query object
$wp_user_query = new

Open in new window

0
Head out to this page: https://www.studweldfast.com/arc-weld-embed-plates/

I'm in the final stages of migrating this site to a different server. Everything seems to be working, but I've run into a problem with the gallery that you see on this page in that the images don't show up.

The problem rests in the path of the images. Here's an example:

 <img src="http://www.studweldfast.com/georgia/wp-content/uploads/2015/08/20150525_161041-400x400.jpg" class="gall-img-responsive" alt="Embed Plates">

Notice the presence of "georgia" in the URL. That directory doesn't exist. When you remove "georgia" from the URL, everything works fine.

I've done a "search / replace" in the database so "georgia" shouldn't be a problem anymore, but I'm still missing something.

This is all a part of the "Responsive Photo Gallery Pro" plugin, by the way. Not sure if that makes any difference...

Is it a config setting that I'm missing? I can't figure out where that path is coming from and I've got to get rid of the "georgia" aspect.

Any ideas?
0
Hi,
I am looking to recreate the pagination on this page:
https://staging1-reogroup.headstudios.com.au/blog/
https://cl.ly/9c0e680a24ed/Image%2525202019-04-02%252520at%2525209.50.17%252520PM.png

As you can see - I want to - as I'm creating a HTML to WP conversion to make those paginations actual real links. The pagination to the left (if it's still there when you check) is a real link. Here's my issue - I want to know how I can do this - whether with a built in Wordpress function or a custom function.

Note: this is in the home.php page template (for blogs) and you can see the source code below:
https://gist.github.com/HeadStudios/b2389c118f7ff036fb62baa16e1ce251

Thanks
0
I have a small website that only will
get about 5 customer CHATS per day.
  ** running WordPress
  ** hosted on my own LINUX box at my home
  ** also running WooCommerce at some point

What "website chat software" do you recommend so I can have a
POPUP appear the minute a potential customer visits the homepage,
displaying "Away Now, Leave a Message" if I mark the system as OFF-LINE ?
  ** cost under $500/yr or $2,000 one-time
0
I'm having trouble getting the slideshow on this page https://www.bluecompasscamps.com/camps/ranch-camp-island-lakes/ to float to the right of the text. The camps on this site are set up using the custom fields for the section with camp type, age, dates, etc and the excerpt box for that small paragraph above them which is the only place I can add the slideshow shortcode, so unfortunately I can't work with the actual layout code and instead have to rely on css alone.

Anyone see what I'm missing there?
0
I'm in the process of migrating a Wordpress site to a new domain / server. I'm using a plugin called "All in One" and it seems to be really intuitive, but I had a question.

At one point in the process, you're confronted with a message that says anything beyond 512 MB is considered beyond the scope of the free utility and it gives you a link to something called, "Servemask." (https://servmask.com/products/unlimited-extension).

I'm wondering if this is something I could do on my own. Meaning, if this is nothing more than adjusting the php.ini file, could I not do this myself without the utility or is there more to it than that?

What do you think?
0
My client has a free cloudflare account. A new developer is having difficulty with the website, and wants to adjust cloudflare's settings to try to get it to work better. But the developer is afraid that they might not succeed and will not be able to return the settings to the current values.

Is there a way to save and restore these settings?
If not, is there a way to get a printout or some type of copy of the settings so that someone could go through this list and change the settings to these values?

THank you.
0
Hello,

I have changed part of  an old Drupal Site to a Wordpress site in a subdomain.  

The main part of the Drupal site still exists, I have just taken the shopping cart portion and built it in a Wordress, which sits in a subdomain

I am trying to redirect the old product pages ot the new ones, but my htaccess code is ignored..

Options +FollowSymLinks
RewriteEngine on

Redirect 301  /cgi-bin/commerce.cgi?preadd=action&key=A30-E https://resources.beststart.org/a30-e-risks-of-cannabis/

Open in new window


I have tried writing the redirect a few ways, all are ignored..  Redirect, RedirectMatch 301, redirectPermanent, etc.

I do have a lor of products as well, it would be good if I could do a wildcard for all /cgi-bin/commerce.cg*
0
Proper way to override a class method.  I have asked this question before in a different manner but am trying to make sure I do it right.  In WordPress / WooCommerce, in the checkout functionality, they have the CC expiration date as numeric so there is no way to give an expiration date of 11/21.  You can not use the separator, so no one on an ios can check out. (at least on the site I am working on)

I need to override a Class method that extends another Class.

Here is the actual Class and Method:

class WC_Payment_Gateway_CC extends WC_Payment_Gateway {

public function form() {

}
}

Open in new window

I need to override form().
So in my functions.php file do?
class My_Extending_class extends WC_Payment_Gateway_CC extends WC_Payment_Gateway {

public function form() {

}
}

Open in new window

Something like that?  Also, how do I initialize my code so it works?
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.