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 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
Fundamentals of JavaScript
LVL 13
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

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
Rowby Goren Makes an Impact on Screen and Online
LVL 13
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

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
I am trying to modify my wp-job-manager template.  

I have an image, and a bit of HTML code I want to show only on certain jobs. I'm using the post-IDs but it's not working.  Basically, if the job is postID19672 then I want a different layout on top, then the rest of the template.  I'm just getting a white page at the moment.  

the page is here -- webpage

<?php
/**
 * Single job listing.
 *
 * This template can be overridden by copying it to yourtheme/job_manager/content-single-job_listing.php.
 *
 * @see         https://wpjobmanager.com/document/template-overrides/
 * @author      Automattic
 * @package     WP Job Manager
 * @category    Template
 * @since       1.0.0
 * @version     1.28.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

?>
<?php
	if( is_page( array('19672', '25239') ) {
<img src="https://cretecarrier.com/wp-content/uploads/2018/04/CreteCarrier_CreteLot-1500x430.jpg" width="1500" height="430" alt="" itemprop="thumbnailUrl" style="left: 0px;">



<div class="single_job_listing">
	
	<div class="flex_column av_one_half  flex_column_div av-zero-column-padding first  avia-builder-el-5  el_after_av_one_half  el_before_av_one_half  column-top-margin" style="border-radius:0px; ">
		<div class="avia-button-wrap avia-button-center  avia-builder-el-6  avia-builder-el-no-sibling "><a 

Open in new window

0
I've inherited a Wordpress site and it appears that someone used absolute links on the home page (the index page).

When I login to the Dashboard, I cannot see anything related to "index" or "home". In fact, I've gone through each individual page looking for clues but still can't find it.

The theme they installed and are running is called Genesis.

They also installed a "Simple 301 Redirects" plugin, but there is nothing there that would indicate a home or index landing page.

How can I find the "index" page of this Wordpress site?

Thanks in advance for your assistance.
0
Exploring ASP.NET Core: Fundamentals
LVL 13
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

I am using WooCommerce 3.5.6 and WordPress 5.0.3 on a local Xampp system.  I need to put some links at the top of each product page that relates to the digestive system and immune system category.  Here is a screenshot of one of the category names.

https://gyazo.com/0db22adb758387199cd0f4f3375404f5

Here is my code

add_action( 'woocommerce_before_single_product_summary', 'thp_single_category', 11 );
 
function thp_single_category() {
 
if (is_product_category('Digestive System') ) {
	echo 'Something else';
echo '<a href="/digestive-process-sp-266">The Digestive Process</a>';
} elseif (is_product_category ('immune system')){
echo 'Something else';
}
 
}

Open in new window


Can anyone tell me why this isn't working?
0
Hi there!

I have a Wordpress site and would like to implement a Members Only area where people would sign up by providing their first name, email address and a password, and this would open up a new area of my site.

Would I do this using a plugin?
0
I've been tasked with moving a Wordpress site to a new host. I've got a rudimentary knowledge of Wordpress and I wouldn't think that moving the files and updating the database config file would be especially difficult. But I'm apparently missing something and I need some input.

The current site is https://www.studweldfast.com/. After copying all the files and changing the database to the correct settings, here's what I'm looking at: http://weldstudpro.com/.

The theme appears to be Executive Pro. I've activated that theme and I'm still looking at something that doesn't come close to the original / what I'm expecting. I've been able to locate the images that I would expect to be present and they are on the new server, but nothings being displayed.

What am I missing?
0
Looking to move audio player from development site.

Hi Guys, i was wondering if i could move the player thats here http://88.202.183.16/~iradiotest/ (when you hit play) to the main site https://iradio.ie (when you hit listen live)

I cant seem to find where the first player lives
0
Hello,

I am using a front end form
http://oalaca.nextmp.net/post-a-job-listing/

<?php acf_form(array(
‘post_id’      => ‘new_post’,
‘new_post’      => array(
‘post_type’      => ‘job_listings’,
‘post_status’      => ‘draft’
),
‘submit_value’      => ‘Post a new Job Listing’
)); ?>

It has 3 date pickers, these 3 all work in the dashboard Add Post form, but they are broken in my public add post form

I do not get any jquery errors in my console

In the Dashboard Add form, all the 3 fields date fields pop up with a calendar date picker
0
Hi Guys,

I was wondering can you help me, i want to move the billboard ad above the title of the page here at https://iradio.ie/123carinsurance and implement the following tracking add on the page, so have it above the 2nd heading "The driving test survival guide" i want it to just show for this page and not every other page on wordpress site?

I thought i had implemented the tracking code, but agency are saying they cant see it

<SCRIPT language='JavaScript1.1' SRC="https://ad.doubleclick.net/ddm/trackimpj/N1397.2105305MEDIACENTRAL/B22239169.241803622;dc_trk_aid=438535703;dc_trk_cid=113136882;ord=[timestamp];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=;tfua=?"></SCRIPT>

Open in new window

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.