WordPress Display Posts Shortcodes

Display Arguments

Arguments are used to customise how the posts are displayed. Below is a list of common arguments you can add to your Display Posts shortcode and examples of how the shortcode should look with the argument added.

author
Specify the post author
Default: empty
Example:

[display-posts author="bill"]

category
Specify the category slug (or comma separated list of category slugs). View this shortcode in action on this example site.
Default: empty
Example:

[display-posts category="fishing,hiking"]

date_format
Specify the date format used when include_date is true. See Formatting Date and Time on the Codex for more information.
Default: ‘(n/j/Y)’
Example:

[display-posts include_date="true" date_format="F j, Y"]

id
Specify a specific post ID (or multiple post IDs) to display.
Default: empty
Example:

[display-posts id="9, 10"]

image_size
Specify an image size for displaying the featured image, if the post has one. The image_size can be set to thumbnail, medium, large (all controlled from Settings > Media).
Default: empty
Example:

[display-posts image_size="thumbnail"]

If you’re using a theme that supports Content Options, and have it set to not show featured images on Pages, the image_size argument will also have no effect on shortcodes used on a page on the site – featured images will not show for any posts added via the shortcode even if the shortcode says they should be shown.

include_content
Include the full post content after the title.
Default: empty
Example:

[display-posts include_content="true"]

include_date
Include the post’s date after the post title. The default format is (7/30/12), but this can be customized using the ‘date_format’ parameter.
Default: empty
Example:

[display-posts include_date="true"]

include_excerpt
Include the post’s excerpt after the title (and date if provided).
Default: empty
Example:

[display-posts include_excerpt="true"]

offset
The number of posts to pass over
Default: 0
Example:

[display-posts offset="3"]

order
Specify whether posts are ordered in descending order (DESC) or ascending order (ASC).
Default: DESC
Example:

[display-posts order="ASC"]

orderby
Specify what the posts are ordered by. See the available parameters here.
Default: date
Example:

[display-posts orderby="title"]

portfolio_type
If you are using the Portfolio post type, use this to get items from a specific portfolio type.

post_parent
Display the pages that are a child of a certain page. You can either specify an ID or ‘current’, which displays the children of the current page.
Default: empty
Example:

[display-posts post_type="page" post_parent="8"]

post_status
Show posts associated with a certain post status
Default: publish
Example:

[display-posts post_status="publish, future"]

post_type
Specify which post type to use. You can use a default one (post or page).
Default: post
Example:

[display-posts post_type="page"]

posts_per_page
How many posts to display.
Default: 10
Example:

[display-posts posts_per_page="5"]

tag
Specify the tag slug (or comma separated list of tag slugs)
Default: empty
Example:

[display-posts tag="tag1, tag2"]

taxonomy, tax_term, and tax_operator
Use these parameters to do advanced taxonomy queries. Use ‘taxonomy’ for the taxonomy you’d like to query, ‘tax_term’ for the term slug (or terms) you’d like to include, and ‘operator’ to change how the query uses those terms (most likely this field will not be needed).
Default: ‘taxonomy’ = empty , ‘tax_term’ = empty , ‘tax_operator’ = ‘IN’
Example:

[display-posts taxonomy="color" tax_term="blue, green"]

wrapper
What type of HTML should be used to display the listings. It can be an unordered list (ul), ordered list (ol), or divs (div) which you can then style yourself.
Default: ul
Example:

[display-posts wrapper="ol"]

Original links:

Change a WordPress user from editor to admin in PhpMyAdmin

A web consulting agency recently took over my admin account essentially locking me out of a website. Fortunately, if you have access to the database via a tool like PhpMyAdmin, you can easily get back in.

First open the wp_users table for the WordPress you wish to access. Look for your account and note down the user ID number:

user-ID

Note: If you don’t have an existing account, you will need to create a new one. (You can check this article on how to do it.)

Next, access the wp_usermeta table and look for your ID number.

In the meta_key field wp_capabilities,
add this meta_valuea:1:{s:13:"administrator";s:1:"1";}

Save and exit and you should now be an administrator again.

More infohttps://themeisle.com/blog/new-wordpress-admin-user/

Enable passive FTP connections in vsftpd

Passive FTP connections rely of the server being able to offer a range of ports to the user. The quantity of ports you need is relative to the number of concurrent users you are expecting to serve. To allow passive FTP, we must first tell vsftpd which ports to use, and then edit the firewall rules to allow connections to those ports.

Edit: /etc/vsftpd/vsftpd.conf

And add:

pasv_enable=Yes
pasv_min_port=12000
pasv_max_port=12100

We then need to modify the firewall to open a range of ports. Ideally, you would restrict access to your own IP address for extra security. On web1 I did this:

-A INPUT -s 12.34.56.78 -p tcp -m tcp -m multiport --dports 12000:12100 -m state --state NEW -j ACCEPT

Assign MySQL Character Set for PHP output

For the old proceedings/programme pages of old events, we were seeing character errors like this:

Thomas L�we

So to fix this I introduced into the configuration.php file the following:

$db=mysql_connect('localhost','username','password') or mysql_die();
mysql_select_db('DBname',$db);
mysql_set_charset('utf8',$db);


PHP.net reference here.

Adding style to hover only when there is href

Today I needed to find a way to style <a> tags that didn’t have href inside them.
You can do that with CSS3 as follows:

a:hover             {background: yellow;}
a:hover:not([href]) {background: none;}

Examples below:

Link One     Link Two     Link Three

yum fail: “package is not signed”

I was not able to yum update web1 today because it would get stuck on one package:

Package gandi-hosting-vm2-2.34-1.noarch.rpm is not signed

I then learned I could bypass this by adding the clause: --nogpgcheck to the command:

yum update --nogpgcheck gandi-hosting-vm2

This way that package alone got updated, which meant I could go ahead and launch the full yum update again without failures.

 

Disable Cortana on Windows 10

If you’re using Windows 10 Professional or Enterprise, the easiest way to disable Cortana is by using the Local Group Policy Editor.

Launch the group policy editor by pressing Windows + R, typing gpedit.msc into the box, and pressing Enter:

gpedit

Navigate to Computer Configuration > Administrative Templates > Windows Components > Search.

Locate the Allow Cortana setting in the right pane and double-click it:

allow-cortana

Set the Allow Cortana option to Disabled and then click OK:

allow-cortana-2

You can now close the group policy editor. You’ll have to sign out and sign back in – or restart your PC – for this change to take effect.

See original article here:
https://www.howtogeek.com/265027/how-to-disable-cortana-in-windows-10/

 

Gmail – Delete emails with large attachments

Permanently delete large emails
  1. In the Search box, type “has:attachment larger:10M“, then click Search Search .
    Note: You can replace “10” with a higher number to search for even larger files.
  2. Select the emails you don’t need, then click Delete Delete.
  3. On the left side of the page, click More > Trash.
  4. At the top, click Empty Trash now.

Disable hiberfile.sys

hiberfile.sys is a huge file normally found in your Windows root directory. Normally it’s a file 75% size of your total amount of RAM. So if you have 32GB installed, you’ll have a 24GB hiberfile.sys file sitting there taking up space for no reason.

If you can live without the hibernation feature (this is more the case for desktops – hibernation is actually quite useful for laptops) then you can disable the feature and remove the file with this simple DOS command:

powercfg.exe -h off

Just remember to launch the  command prompt and “Run As Administrator”.


More info here:
https://www.cnet.com/how-to/how-to-enable-or-disable-hibernate-in-windows-10/

Query another DB from within WordPress

Add this line to change the default DB to another one:

$wpdb = new wpdb('username','password','database','localhost');