A Few Essential WordPress Skills to Better Manage your Website

A Few Essential WordPress Skills to Better Manage your Website

By Rob Gravelle
Tweet

Since its initial launch in 2003, WordPress has grown into one of the most popular open source content publishing systems around. Maybe that’s because, even with hardly any knowledge of CSS, PHP, HTML and JavaScript, WordPress can help you create an impressive site. Having said that, to achieve a more interactive and dynamic website, you will need to hone a few useful proficiencies. Having worked with WordPress for a number of years now, I have a few specific WordPress skills to suggest. In today’s article, I’ll present some of my top picks.
PHP Coding

It isn’t immediately obvious from the management pages, but all of WordPress is written in PHP. Some of these files are part of the core that should never be tampered with, while others are there to be modified to better customize your site. WordPress contains two built-in editors that allow you to edit Theme files directly from within WordPress admin. They are the Theme Editor and Plugin Editor. The Theme Editor is accessible from the Administration > Appearance > Editor menu, while the Plugin Editor is located at Administration > Plugins > Editor.

In my experience, most edits take place in the functions.php file, located in the Themes folder. It’s a special WordPress Plugin that adds features and functionality to a WordPress site. You can use it to call both PHP and built-in WordPress functions, as well as define your own functions.

functions_php_file (179K)

Here is some example code that redirects to another page if the current user may perform a particular action. Note that the current_user_can(), wp_redirect(), and mm_corepage_link() functions are WordPress functions, while stripos() and array() are native to PHP:
? 1 2 3 4 5 6 7 8 9 10 11
if ( !current_user_can(‘manage_options’) ) {
function profile_redirect() {
$result = stripos($_SERVER[‘REQUEST_URI’], ‘profile.php’);
if ($result !== false) {
wp_redirect( mm_corepage_link( array(“type”=>”myaccount”) ) );
}
else if ( stripos($_SERVER[‘REQUEST_URI’], ‘index.php’) !== false) {
wp_redirect( mm_corepage_link( array(“type”=>”homepage”) ) );
}
}
}
Familiarize Yourself with WordPress Action and Filter Hooks

While learning PHP is certainly a great start, you won’t get very far in WordPress until you can link your functions to WordPress. This is accomplished using hooks. In WordPress, a Hook is a function where you can add your own code or change what WordPress is doing or outputting by default. The “doing” and “outputting” map to two types of hooks called actions and filters respectively. An Action in WordPress is a hook that is triggered at specific time when WordPress is running and lets you take an action. This can include things like adding a menu item when WordPress is initializing or preforming some sort of validation when someone publishes a post. A Filter in WordPress allows you get and modify WordPress data before it is sent to the database or the browser. Some examples of filters would include customizing how excerpts are displayed or adding some custom code to the beginning or end of a blog post.
Adding an Action Hook

To “hook” into a WordPress action, you call the add_action() function, passing in the hook name and function name. The add_action() function also accepts a couple of optional arguments. The priority is an integer value based on a scale of 1 to 999 that determines the priority of order for functions tied to that specific hook. A higher priority means it will run later, while a lower priority means it will run earlier. The $accepted_args parameter is used to pass multiple arguments to your function.
?
1

add_action( $hook, $function_to_add, $priority, $accepted_args );

Here is the call to add_action() that invokes our profile_redirect() function when WordPress performs the ‘admin_menu’ action. This action is used to add extra submenus and menu options to the admin panel’s menu structure and runs after the basic admin panel menu structure is in place.
?
1

add_action(‘admin_menu’, ‘profile_redirect’);
Adding a Filter Hook

The add_filter() function accepts the same arguments as add_action(), but filters WordPress output instead. As such, your function both receives a value and has to return it at the end of the function. Actions, on the other hand, simply run the code they need to and don’t return a value.
?
1

add_filter( $tag, $function_to_add, $priority, $accepted_args );

Here is some code that adds a “Duplicate” link to items on the list table using the “page_row_actions” filter. It passes an array of row action links to our “duplicate_post_link” function, along with the Post object. Default row action links include ‘Edit’, ‘Quick Edit’, ‘Restore, ‘Trash’, ‘Delete Permanently’, ‘Preview’, and ‘View’.
?
1 2 3 4 5 6 7 8 9
function duplicate_post_link( $actions, $post ) {
if ($post->post_type == ‘menu’) {
$actions[‘duplicate’] = ‘Duplicate‘;
}
return $actions;
}
add_filter( ‘page_row_actions’, ‘duplicate_post_link’, 10, 2 );

Info fast secure contact form 2417

Table: hs_cf7dbplugin_st = submit_time (decimal(16,4)

Select: hs_cf7dbplugin_submits =
{
submit_time decimal(16,4)
form_name varchar(127) NULL
field_name varchar(127) NULL
field_value longtext NULL
field_order int(11) NULL
file longblob NULL
}
This is interesting because we have multiple values per submit time. this is similar to a post_id value.

meta boxes 1957

meta box test 1957

hide title widget (altered) works well.
date time widget (altered) works well.
auto refresh widget ( altered) works well.
will use snippet because it is easier and a more natural approach.
I do not think I will use meta boxes.
It is to easy to just adjust the meta fields to not show them. and move on.

what goes here 1957
—————–

SkyPost-1596

Remember keep post and pages in there places. Also make plugin to turn page into a daily post.
this page is not a page but a post therefor it does not display the meta data “the_meta” remember this.
———————————–
Sky Post-1596






  • works in . Safari !



  • (rotating pages)





so where is the page meta?

The MEAN Stack | OpenShift by Red Hat

The MEAN Stack

MEAN stack logo mashup (unofficial)

Looking for a new spin on the popular open-source classic, the LAMP stack?

MongoDB ExpressJS AngularJS NodeJS

The MEAN Stack is a potent new concoction of javascript-flavored open source tooling, services, and frameworks.

These ingredients all blend together quite nicely to provide a full-stack development experience that makes modern single-page application design a breeze.

If you are interested in keeping up to date with powerful new technologies like asyncronous javascript, NoSQL, JSON, and AngularJS’s declarative client-side application design – then you’ll definitely want to give the MEAN stack a try.

Grab a free OpenShift Online account, and follow these simple steps to get up and running with your own cloud-hosted MEAN stack application:

via The MEAN Stack | OpenShift by Red Hat.