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,

I am trying to check if an advanced custom field date field is past today. So far it works for my wp_query no problem, but if i try to check it in an IF statement, the first result is broken.
see my page https://fasdinfotsaf.ca/en/live-events-feed/ when i display my dates in an echo.

Basically i am scrolling though events, and if it is a past event I want to put a "past events" heading

so query works great..

but if you look at my live page, the very first post has a date of 01/01/1970 12:00:00 AM UTC which is triggering my title display, every other date following it is correct, it is just the first result

<?php  
	$showonce = 0;
	$the_query = new WP_Query( array('posts_per_page'=>10,
                                 'post_type'=>'live_events',
								 
								 'meta_key'          => 'start_date',
    'post_status'       => 'publish',
    'orderby'           => 'meta_value',
    'meta_type'         => 'DATE',
    'order'             => 'DESC',
	
                                 'paged' => get_query_var('paged') ? get_query_var('paged') : 1) 
                            ); 
                            ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); 
?>
<div class="col-xs-12 file">



<?php
if($showonce == 0){
$datetime = strtotime( get_field('start_date') ); // Convert to + seconds since unix epoch
$yesterday = strtotime("-1 days"); // Convert today -1 day to seconds since unix epoch
if ( $datetime >= $yesterday ) { // if 

Open in new window

0
We're having issues with a client's Wordpress web site that we've 'adopted'. This site worked fine but we've installed a new theme and we're having issues with it. It works fine on our testing server which happens to be a Cpanel-based host. However, when placed on our live server (Plesk) it throws errors on and off (a bit randomly, it seems).

We're getting sporadic Internal Server 500 errors which, when we look at the logs, shows us this:
(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server

We've tried switching from Fast CGI, to just CGI and FPM but then we get this error:
Unable to allocate shared memory segment of 67108864 bytes: mmap: Cannot allocate memory (12)

Lots of Googling has been done but we've not found a solution yet.

OS:      ‪CentOS 6.10 (Final)‬
Product:      Plesk Onyx
Version: 17.8.11 Update #38,

CPU      Intel(R) Xeon(R) CPU E5649 @ 2.53GHz (2 core(s))
3GB RAM (looking at it now, it's using 35% of that)

Any ideas we can look at would be appreciated please!
0
My client wants to configure two types of shipping in her Woocommerce store:
1. Some products will be $12 shipping, regardless of how many products are ordered.
2. The remaining products will be $12 shipping for the first item, but $6 shipping for all additional items.

Can this be done without a woocommerce extension? If not, which extension would enable this?

Thank you.
0
Turning OFF my WordPress Site?

I have the Admin login to my WordPress site, but I need to turn it off.

I do not care where the domain points afterwards.

How do I "unpublish" the site?

Thanks
0
This is a follow on from this question.

https://www.experts-exchange.com/questions/29132557/Javascript-Button-Need-OnClick-To-Reset.html

I need the message from this php snippet to post in the order notes box on WooCommerce.  I am using Wordpress 4.9.8 and WooCommerce 3.5.4.  This code isn't working.

add_action ('woocommerce_before_order_notes', 'display_member');
//echo '<pre class="ee_debug" style="display: none">' . print_r($_COOKIE, true) . '</pre>';
function display_member($order_id) {
echo '<pre class="ee_debug" style="display: none">' . print_r($_COOKIE, true) . '</pre>';
	if (isset($_COOKIE['wantmembership'])) {
   //if ($_COOKIE['wantmembership'] = 1) {
    echo 'YES!';
//if (isset($_COOKIE['wantmembership:1'])) {
    // The user wants membership
//echo "I want membership2";
$order = wc_get_order(  $order_id );

// The text for the note
$note = __("I Want Membership");

// Add the note
$order->add_order_note( $note );

// Save the data
$order->save();
  }
}

Open in new window


It is giving this error

	<pre class="ee_debug" style="display: none">Array
(
    [wp-settings-69338] => editor=html
    [wp-settings-time-69338] => 1548795169
    [wp_woocommerce_session_ec34ebe84fc325c20ff14f13d4d89876] => 69338||1548967975||1548964375||773934e5a3140d57836d39966a61c48f
    [of_current_opt] => #of-option-globalsettings
    [wordpress_test_cookie] => WP Cookie check
    [wordpress_logged_in_ec34ebe84fc325c20ff14f13d4d89876] => 

Open in new window

0
This is a follow on from this question.
https://www.experts-exchange.com/questions/29132557/Javascript-Button-Need-OnClick-To-Reset.html

Open in new window



This is the current error

	<pre class="ee_debug" style="display: none">Array
(
    [__stripe_mid] => 64c96aca-233e-4091-a8a5-2eef8b3ffc06
    [wp-settings-69338] => editor=html
    [wp-settings-time-69338] => 1548774822
    [of_current_opt] => #of-option-globalsettings
    [wp_woocommerce_session_ec34ebe84fc325c20ff14f13d4d89876] => ce0f477d8bf01c601d8f3113b3fcc354||1548969520||1548965920||2173822770d04d88ad3a9bfb8abc8cdb
    [wordpress_test_cookie] => WP Cookie check
    [woocommerce_items_in_cart] => 1
    [woocommerce_cart_hash] => f1e39a061842b8f884c91f54c2ab6fba
    [wordpress_logged_in_ec34ebe84fc325c20ff14f13d4d89876] => sharingsunshine|1548972461|sXqfvPjiY96SFwZJOXNyUKODb2YZtd8Vr1h6JHJkCrA|c4b2f47b2eead8b4f23032764afe3babd9932be9183650096fcd334a2d25e95d
    [wantmembership] => 1
    [__stripe_sid] => 43c996d1-f787-45db-b38e-74a122d96ec5
)
</pre>YES!<br />
<b>Fatal error</b>:  Uncaught Error: Call to a member function add_order_note() on boolean in C:\xampp\htdocs\tfl\wp-content\themes\flatsome-child\functions.php:285
Stack trace:
#0 C:\xampp\htdocs\tfl\wp-includes\class-wp-hook.php(286): display_member(Object(WC_Checkout))
#1 C:\xampp\htdocs\tfl\wp-includes\class-wp-hook.php(310): WP_Hook-&gt;apply_filters('', Array)
#2 C:\xampp\htdocs\tfl\wp-includes\plugin.php(453): WP_Hook-&gt;do_action(Array)
#3 

Open in new window

0
Dear Experts,

I have the following codes used to work in PHP 5.0 and suddenly it stop working after I upgraded to PHP 7.2
 
$query_sql = "SELECT * FROM wp_posts WHERE post_title = %s ORDER BY post_title;";
$query = sprintf($query_sql, mysql_real_escape_string($name));
$postquery = $wpdb->get_results("{$wpdb->prepare($query)}");

echo 'Rows: ' . count($postquery);

The row count return 0.

Please help. Thank you in advance.
0
I have a website created with Wordpress and I need to delete a link on it.  I know nothing about this stuff.  Our website creation company is not getting back to me but I do have access (I THINK) to being able to do what I need to do.  Take a look at the screenshot.  There is a link when you hover over company (in green) that says company meeting question.  I need to find where this is in wordpress editor and delete it.  The link brings you to an online suggestion box website.
0
Hi There,

I'm having a little problem with a JS snippet I have on my website, which blocks a search of California.
We don't currently hire in California and have no listings, but we have a sticky job that comes up whatever state or location is entered.
I got the below snippet code, which if you type in ('ca', 'cal', 'cali', 'california', 'california ', 'los angeles', 'san fransisco', 'san diego', '90210', ) it will block the ability to select a freight type, and thus shows no listings, plus an alert.  

This is great for that part,  but if you search for something in say new york, it will bring listings up as intended, but say you then try to enter California again, it will give you the alert, but will also load the sticky job.  

How could i modify the code, so if listings are already there, and you try to search for California jobs, the listing hide?  I was thinking something like the ul.job_listings div is set to display none if it matches criteria, and then display if not California.

Hope this makes sense.  ...  Basically want ZERO jobs to show if you enter California, or CA, or Los Angeles.  ie post 19672 to not appear for California searches.

Website - Job Search.
		<script>
			$(function() {
			$('body').on('blur', '#search_location', function() {
				var excluded_cities = ['ca', 'cal', 'cali', 'california', 'california ', 'los angeles', 'san fransisco', 'san diego', '90210',  ];
					if 

Open in new window

1
I am using Xampp 3.2.2 wanting to build a test site that is running Wordpress 4.9.8 (used bitnami module).  The site worked and I could login to the dashboard but I needed to change the mysql database and now I can't login to the dashboard.  Instead it goes to my-account.

I have setup a new user following the guidelines on the net on how to create an admin account via phpmyadmin.
https://www.godaddy.com/help/create-a-new-wordpress-admin-user-in-the-database-27023

Open in new window



I have cleared all cookies and I made the changes in wp_options (see screenshot).

https://gyazo.com/b603e50437b5481a521322e0ca43a6f8

my host file is pointing 127.0.0.1 to http://www.test-tfl.com in this manner
127.0.0.1 www.test-tfl.com

Open in new window


Please help me to be able to login to the wordpress dashboard.
0
For my wordpress blog (hosted at wordpress.com / business plan /  my domain ),  I create custom ads which are basically  a .JPG image linked to the advertiser.
 
These are not Google Adsense or jetpack ads.  

What's the most popular /well-supported plugin/solution for me to create an ad (picture w/ link) , have them automatically interspersed between posts, and permit me to specifically place them in certain locations on the left & right?

I don't know if Wordpress.com as a hosting company has any restrictions.

The guy who ported my site to wordpress.com wrote a custom plugin but I don't want to be tied to this guy forever.

Thanks for any suggestions,
Mike
1
So, I have been reading about this for a long time and there's never a conclusive answer to be found anywhere.

I have a Centos 6 LAMP web server which mostly hosts websites created by yours truly and the occasional website created by someone else.

Which is the most secure way to configure Wordpress folders ownership AND keep all the automatic features (updating, uploading and so on) without the need to insert ftp or sftp credentials each time?

Aside from permissions (which I always set to 755 for folder, 644 for files and 600 for special files, as suggested everywhere), there's a lot of different ideas about ownership.

Somebody says apache should be the owner of the whole folder. Somebody says that the owner should be your server user (root for instance, or a dedicated user) and never apache.

But if the owner is not apache, you have to use your ftp credentials to upload, update and so on.

So is there a way to actually have it all? What's the safest and smartest way to configure ownership for Wordpress?

Thanks guys.
1
I have a Wordpress webiste with Pay Per View plugin (https://wpmupremium.com/wordpress/pay-per-view-plugin/) which shows 500 words for non-subscribers for free.

However, I want Google to index the whole blog post not just those 500 words.

Google recommends using the JSON/Scheme for that purpose in order to avoid the cloaking penalty.

Would you be able to help me - write and explain the implementation of that code to my Wordpress blog?

Here are the recommendations from Google - https://developers.google.com/search/docs/data-types/paywalled-content
0
Hello,

I got a new website client today because they were hacked. It had all the usual base64 code on every index file. In addiction, I found a file replicated maybe 1000 times  msv.php and it contains something that create a new cron tab and this line

SNl  13:01   0:00 ./cnrig -a cryptonight-light --donate-level 1 --max-cpu-usage=40 -o pool.aeon.hashvault.pro:3333 -u

as well as some other code...

Aeon.hashvault.pro which appears to be some bitcoin mining thing. Anyone have any info on this?

Also, these files were below the public_html root... should i delete the entire cpanel account and start from scratch?
0
Hello,  I am having problems with a WordPress plugin call WP-Job Manager, particularly trying to create a custom template for single jobs.

I have customized the default template by copying "content-job_listing.php"  from the plugin directory to  /themes/enfold/job_manager/content-job_listing.php. This works great, and is my template for all jobs. See code below.

<?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
}

?>
<div class="single_job_listing">
	
	<h2><?php the_title(); ?></h2>
		
	<div class="hide_above_mobile">
		<?php display_job_phonenumber_data(); ?>
	</div>
	
	<?php if ( $apply = get_the_job_application_method() ) :
		if ( $apply->type === 'url' ) {
	    	$application_href = $apply->url;
		} elseif ( $apply->type === 'email' ) {
	    	$application_href = sprintf( 'mailto:%1$s%2$s', $apply->email, '?subject=' . rawurlencode( $apply->subject )  );
		}
	?>
	
	<div class="application">
		<a class="application_button button" href="<?php echo $application_href; ?>" target="_blank"><?php _e( 'Apply for job', 'wp-job-manager' ); ?></a>
	</div>

	<?php endif; ?>

	<?php the_content() ?>
	<?php 

Open in new window

0
I need to display and image on the single product page of Woo Commerce.  However, when I use this function nothing is displaying it seems my problem is how I am referencing the image.  The image is in the media library.

add_action ('woocommerce_after_add_to_cart_button', 'display_calif', 10);

function display_calif() {

if ( has_term( 'california', 'california_temp' ) ) {
echo '<img src="/wp-content/uploads/2019/01/california.gif" />';
        }
}

Open in new window


Please tell me how to reference this image.
0
A small real estate firm is looking to have a website that would display their property listings, blog, documents and other static information.
It needs to be mobile compatible as well.
They want to post the listings themselves.

Is there a company that produces these sites?  Something that runs under WordPress?

Thanks.
0
Friend transferred a wordpress site to a new VPS, the new host is displaying SOME pages but not all pages.

For example /category/mypage works
but category/mypage2 returns 500 server error

Wp-admin works, so i dont htink its a database issue, i re created the htaccess file, no luck.

When i inspect the  broken page it says <!-- html is corrupted -->

They are using the wordpress fastest cache plugin, not sure if that helps (even though i look into the cache folder and not all the pages are in here? is it permissions? i set 777 temporarily on those folders but look slike Fastest Cache isnt loading those pages into the cache)


Any ideas other than corrupted pages one one page would return 500 server error?
0
I have a javascript button at https://www.theherbsplace.com/rebate-program/ it is found at the bottom of the page.

Here is the code
<script>
document.getElementById("order_comments").innerHTML = "I want membership";
</script>

Open in new window


<p><a class="button exclusive biz-op-button" title="I Want Membership!" href="#" data-register="true">Get My Membership</a></p>
<p class="form-row notes" id="order_comments" data-priority="">
    <label for="order_comments" class="">Order notes&nbsp;<span class="optional">(optional)</span></label>
    <span class="woocommerce-input-wrapper">
        <textarea name="order_comments" class="input-text " id="order_comments" placeholder="Notes about your order, e.g. special notes for delivery." rows="2" cols="5"></textarea>
    </span>
</p>

Open in new window


The button works fine but I need it to change colors and text on click.  This is so the customer will know their request has been logged.

I am not very strong in javascript.  I see on the net some examples but I don't know enough to fold them into what I already have working.

Thanks,
0
Hello,

I need help modifying my WordPress XML feed.   Currently, I am using the WP Job Manager plugin, and have a custom rss feed for a client.

For one of the fields,  they require only the city, but it outputs as city, state, country. see below.

<cityHiring>
<![CDATA[ Wheatland, WY, United States ]]>
</cityHiring>

Changed to this:
<cityHiring>
<![CDATA[ Wheatland ]]>
</cityHiring>

So basically i need everything after and including the first, to be removed.

In the theme code, the field has this PHP
echo $the_job_location;
				?>
		</city>

Open in new window

0
We're using WordPress for our Extranet site which is stored on servers outside of our organization.  We usually upload files to the site that users can download by clicking on a link.   Problem is every time we update a document we need to upload it again.

Is there a way to create a WP link that references a local file on our servers. ?     The computers that are accessing this site are all on our network and would have access to this location.

Thanks ….

Joel
0
HI Experts,

I have a child theme based on Appointment Pro that I am using on www.atlas365.ca

As you can see, in mobile view I have a burger menu, but how can I make the burger menu appear in tablet view as well, in order to avoid the menu overlap the logo?

Thank you,
0
Hi there, I'm trying to put a theme shortcode in my wordpress template file.

I'm getting the following error "Parse error: syntax error, unexpected 'echo' (T_ECHO) in /www/wp-content/themes/enfold/includes/loop-big6.php on line 30"

test website here
<?php
global $avia_config, $post_loop_count;

$post_loop_count= 1;
$post_class 	= "post-entry-".avia_get_the_id();



// check if we got posts to display:
if (have_posts()) :

	while (have_posts()) : the_post();
?>

		<article class='post-entry post-entry-type-page <?php echo $post_class; ?>' <?php avia_markup_helper(array('context' => 'entry')); ?>>

			<div class="entry-content-wrapper clearfix">
				
				<img class="vv" src="https://idgiyn5kp0-flywheel.netdna-ssl.com/wp-content/uploads/2018/04/CreteCarrier_OfficeBlueShirt-1500x430.jpg" alt="rr" width="100%" height="230px" />
				
				<?php if ( $apply = get_the_job_application_method() ) :
						if ( $apply->type === 'url' ) {
							$application_href = $apply->url;
						} elseif ( $apply->type === 'email' ) {
							$application_href = sprintf( 'mailto:%1$s%2$s', $apply->email, '?subject=' . rawurlencode( $apply->subject )  );
					} ?>
				<?php endif; ?>
				
				 <?php echo do_shortcode('[av_one_third first margin="0px" padding="0px" radius="0px" mobile_breaking="" mobile_display="" av_uid="av-y5kp57"] 
					 <a class="application_button 

Open in new window

0
I have a client who i developed a single page static HTML/CSS landing page for. These landing pages are for real estate properties, so all pages are identical, except they all live on their own domain (www.myproperty.com) and have different images and information. So far to manage its been super simple, i point my godaddy domains to Digital ocean, apply LetsEncrypty, copy the template over and fill in the blanks and i have a super light performant website all done within 30 minutes.

The client has now sent me a few new "designs" from a theme they want to use, the problem is, this theme is WordPress. Ideally i want to avoid wordpress because i am maintaining the site and its unnecessary for me, also the themes use page builders and are bloated with html and css, i know i can tweak it heavily to make it close to as performant as a static page but again i feel this is unecessary. I go the wordpress route im going to have to charge them setup costs + an additional security and maintenance fee (monthly) on top of hosting because i will have to actually manage wordpress itself (updates, plugins, all that fun crap that breaks when you run updates, etc).

My options:

1. Charge them to convert the theme to raw HTML/CSS and continue deploying the sites as i already do. This will cost them more upfront as it will take 20-40 hours to do but i can keep my existing workflow (all pages have their domain name, and SSL) and wont have to charge them any additional monthly costs

2.  …
1
I have some reports that are generated from our WordPress sales app and I'm changing the way the room selections work.

I need to know what the code below is doing, or more specifically, layman's terms of the syntax - $selected_czar_room = ($_POST['czar_room'] == 'default') ? '' : $_POST['czar_room'];

I know it's getting room info from the post and then setting a cookie and expiration, but the behavior of the cookie is different with my new room selection code that pulls the rooms dynamically from the DB instead of being hard-coded in the page. With it hard coded, the cookie "resets" if I change the room. With it selected the new way, the cookie does not reset and the report will pull from the previously selected "room".

So what is the code "saying" here - > $selected_czar_room = ($_POST['czar_room'] == 'default') ? '' : $_POST['czar_room'];
As in, set this variable ($selected_czar_room) to equal the post value of 'czar_room' ,,  and then I'm lost
I don't know what == 'default') ? '' : $_POST['czar_room']; means.

Thank you!

if ($_POST['czar_room']) {
            setcookie("ROOM_TP", ($_POST['czar_room'] == 'default') ? '' : $_POST['czar_room'], time() + 365 * 24 * 60 * 60, "/");
            $selected_czar_room = ($_POST['czar_room'] == 'default') ? '' : $_POST['czar_room'];
        } else {
            $selected_czar_room = $_COOKIE["ROOM_TP"];
        }[code]

Open in new window

[/code]
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.