Install and Running Supervisord in virtualenv python 2.7

The thing is your default python is 3.x and supervisord is not stable/ready yet for python 3.x so i suggest a solution is to run supervisord in virtualenv of python 2.7

Yes. You can first setup a virtualenv and then install supervisor use pip.

Create configuration file:

You can run multiple instances, just use different port supervisord listen on in configuration file:

Briefly available for scheduled maintenance message - with fiery background.

Urgent fix: Briefly unavailable for scheduled maintenance. Check back in a minute.

Ever tried updating some WordPress plugins and had the screen freeze? Did you refresh madly only to end up with this messages

Well don’t panic. The fix is easy and I’ll walk you through it.

Why this happened

When you go to update a plugin, WordPress puts itself in a temporary maintenance mode state. When you see the “Briefly unavailable…” message, that’s a WordPress-generated notification that alerts any visitors about what’s happening with your site.

This message is normal behavior.

What’s not normal is when your server has a slow response time or for some reason the update script is interrupted (or times out). In that case, the friendly notification morphs into a moment of dread and panic.

How to fix it.

When this happens, WordPress generates a .maintenance file in the root directory of the installation. With normal behavior, the update script completes and WordPress auto-removes the .maintenance file. In the case of an interruption of some sort, this file doesn’t get deleted and the message won’t go away.

The answer? Delete it manually and your live site is back to work now, hope it save your day.

meks_time_ago_options

Change WordPress post date format to time ago

WordPress offers you a nice solution to change your WordPress date format or time format in general settings of your admin dashboard. However, some people may prefer to have so-called “time ago” format in the similar way to Twitter and Facebook style like posted “10 minutes ago”, “1 hour ago”, “3 hours ago”, etc…

Here this can help with function human_time_diff

 

meks_time_ago_options

How to Generate Password Strong Online

If you want a quick and easy way to make a strong password, there are plenty of ways to generate strong passwords online. Let’s take a look at some of the best that help you how to generate password strong online.

 

Generator Password Strong is a simple way to make a strong password. You can set how long you want your password to be, from 6 all the way to 2048 characters. This is useful if you want to use it on a site with a strict password length requirement.

passwords-online-last-pass

LastPass is a service that remembers all your passwords so you don’t have to. Their password generator tool is a useful tool that quickly makes a strong password for you. Just tell it the minimum amount of characters you want it to be, click “Generate”, and a password is created.

passwords-online-random

Perfect for sticklers of “true” randomness! Random.org has provided random number generation based on background radiation, which is one of the more randomly-occuring phenomenon in nature. Their password generator uses this method to become the most “truly random” way to generate strong passwords online.

passwords-online-keygen

“Memorable passwords” focus on creating a password that’s easy to remember while still holding up to brute force. If passwords being memorable isn’t a top priority (either because you have a password manager or a stellar memory!), you can use very strong passwords that are sure to keep you secure. The site also generates passwords that can be used for WPA and WEP routers too.

Get Featured Image URL programmatically

Post thumbnails are pretty useful and pretty easy to use in WordPress. Simply add:

To a theme’s functions.php file and you’ll get a Featured Image module on the admin screen for posts which allows you to select one.

It is also very easy to output that image as an HTML <img>:

But what if you just need the URL? Say, you’re going to use it as a background-image on an element rather than a content image. Unfortunately there is no super easy/obvious function for that.

Within the loop, you’ll have to do:

Then $thumb_url will be that URL.

python strip html tags like strip_tags in php

Earlier this week I needed to remove some HTML tags from a text, the target string was already recorded with HTML tags in the database and one of the requirement specifies that in some specific page we need to render it as a raw text.

I knew from the beginning that regular expressions could apply for that challenge, but since I am not an expert with regular expressions I looked for some advise in stack overflow and then I found what I actually needed.

Below is the function I have defined:

Searching Posts Programmatically in a WordPress Plugin

If I navigate to Posts -> All Posts in a WordPress install, there’s a Search Box in the upper right hand corner. Entering terms in this box and clicking the Search Posts button will perform a search.

Does WordPress provide a hook, function, or other API that would allow me to programmatically perform the same (or a similar) search? i.e. I pass in a string as terms and get back a PHP array of results without needing to write any SQL myself.

If not, does anyone here know where in the WordPress core code the above search happens? (so I cam mimic the behavior as best as possible)

Count search results

On my wordpress search page I would like to show a ‘total found results’. This needs to be shown at the top of the page in a heading.

I’ve tried this code but I gives me only the results of the specific page. What I want is all the results, not just the page.

 

WordPress how to find where a shortcode comes from

Just use the Windows search bar in wp-content directory and search for companyName_apply_form. You should find the file where the shortcode is created.

To add a shortcode in WordPress you normally use this syntax:

So with basic linux skills, you can find the function_name + file that define the shortcode_name

… and the results

 

WordPress how to get current url woocommerce product

I am trying to get Woocommerce product permalink by given product name. I know I can get permalink by given product ID like this:

But I can not find any code to get it by product name. I tried this:

Or in the woocommerce template, you can follow the following snippets

WordPress Get ID of Current Category

Getting the ID of the current category in WordPress is actually quite simple.

How can I retrieve slug of current taxonomy being viewed in taxonomy template?

To further explain, lets say I am viewing category flowers so how can I retrieve slug of category flowers?

We are going to use get_queried_object() to accomplish this task. The following script will get all the information about our queried object and put it in an array, $category. Then we are simply getting the term_id from that array and echoing it.

You can get the term object of the category you’re viewing with get_queried_object(). That will contain the slug.

Just place that code in any template file where a category has been queried, such as category archive pages, and you will be able to get the category id no problem.