Create your own SEO plugin

<? Php

/ **

* @package Plugin_SEO

* @version 1.0

* /

/ *

Plugin Name: My SEO plugin

Plugin URI : https://ayudawp.com/

Description: Add meta boxes to include "description" and "title" goals for Open Graph and search engines.

Author: Fernando Tellado

Version: 1.0

Author URI: http://tellado.es

* /

function tes_mb_create () {

[19659021] / **

* @array $ screens Screen in which the meta box will be displayed

* @values ​​post, page, dashboard, link, attachment, custom_post_type

* /

$ screens = array ( 'post' 'page' ) ;

foreach ( $ screens as $ screen ) {[19659014] add_meta_box (

'tes-meta'

'SEO Settings helpWP' [19659014]

'tes_mb_function'

$ screen

'normal'

'high'

) ;

}

}

add_action ( 'add_meta_boxes' 'tes_mb_create' ) ;

function tes_mb_function ( $ post ) {

/ / if exist is [19659044] recover the values ​​ from the metadata

$ tes_meta_title = get_post_meta (] $ post -> ID '_ tes_meta_title' true ) ;

] $ tes_meta_description = get_post_meta ( $ post -> ID '_ tes_meta_description ' true ) ;

// A nonce field is added to test it later when we validate

wp_nonce_field ( 'tes_inner_custo m_box ' ' tes_inner_custom_box_nonce ' ) ;

echo '

'

Label "title":

<input style = "padding: 6px 4px; width: 300px "type =" text "name =" tes_meta_title "value =" ' . esc_attr ( $ tes_meta_title )

. '"/>

Meta" description ": ' . esc_attr ( $ tes_meta_description ) . '

' ;

}

[19659015] function tes_mb_save_data ( $ post_id ) {

/ *

* We have to verify that this provie ne of our screen and with the appropriate authorization,

* to launch save_post at any other time.

* /

// We check if the nonce has been defined.

if ( ! isset ( $ _ POST [ 'tes_inner_custom_box_nonce' ] ) )

return $ post_id ;

$ nonce = $ _ POST [ 'tes_inner_custom_box_nonce' ] ; 19659014] // Verify that the nonce is valid.

if ( ! wp_verify_nonce ( $ nonce 'tes_inner_custom_box' ) )

return $ post_id ;

// If it is a self-safeguard, our form will not be sent, as we do not want to do anything yet.

if ( defined ( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE [19659017])

return $ post_id ;

// We check user permissions.

if ( 'page' == $ _ POST [ 'post_type' ] ) {

if ( ! current_user_can ( 'edit_page' $ post_id ) )

return $ post_id ]

} else {

if ] ( ! current_user_can ( 'edit_post' $ post_id ) ] )

return $ post_id ;

}

/ * Ok, it's safe to keep the data. * /

// If there are old entries, we retrieve them

$ old_title = get_post_meta ( ] $ post_id '_ tes_meta_title' true ) ;

$ old_description = get_post_meta ( $ post_id '_ tes_meta_description' true ) ;

// We clean what the user entered.

$ title = sanitize_text_field ( $ _ POST [ 'tes_meta_title' ] [19659017]) ;

$ description = sanitize_text_field ( $ _ POST [ 'tes_meta_description' ] ) ;

// We update the meta field in the database.

update_post_meta ( $ post_id '_ tes_meta_title' $ title ] $ old_title ) ;

update_post_meta ( $ post_id ] '_ tes_meta_description' $ description $ old_description ) ];

}

add_action ( 'save_post' 'tes_mb_save_data' ) ;

function tes_mb_display () {

global $ post ;

// recupe We have the values ​​of the metadata if they exist

$ tes_meta_title = get_post_meta ( $ post -> ID '_ tes_meta_title' true ) ;

$ tes_meta_description = ] get_post_meta ( $ post -> ID '_ tes_meta_description' true ) ;

echo '

<meta property = "og: title" content = "' . $ tes_meta_title . '"/>

<meta property =" og: description "content =" ' . $ tes_meta_description . '"/>

<meta name =" description "content ="' . [19659026] $ tes_meta_description . '"/>

' ;

}

] add_action ( 'wp_head' 'tes_mb_display' ) ;

?>

Hide cover entries • WordPress Help

There are many reasons why you may want that certain entries are not shown on the cover in the loop of your WordPress site, either because the theme is not the usual or simply because you want to give a specific entry a concrete treatment.

But if this need will only arise on a specific occasion then nothing better than WP hide post a simple plugin that ] adds a new meta box to your ticket editor from which …

Only for the last two possibilities is it worth the plugin, but surely with all the options it offers you will be useful in more than a project.

Oh, and if you want you can also use the visibility options offered for pages, also very useful.

Drag and drop featured images • WordPress Help

With the news of the image loader in WordPress 3.5 file management has become much easier, let alone the use of galleries, but there seems to be an element that has been left parked: the featured images .

Of course they are integrated in the new image loader but the editor's meta case is a bit useless, just open the loader again for, now, assign a prominent image In short: a waste of time, more in the current times.

A good idea to buy time in this task is offered by the plugin " Drag & drop featured image ". Its function is simple but very imaginative, and above all useful: convert the meta case from " Featured image " in an area of ​​" drag and drop " so you can easily add images from your computer as highlighted.

You can also drag and drop images from the gallery, but you need to launch the image loader, so it's not very useful in this regard.

How to access WordPress administration • WordPress Help

What usually happens is that the templates (themes) by default always include a block called " Meta " where the links to access WordPress come .

But as the first thing we do when installing a WordPress is to start adding widgets or changing the theme (template) that block sometimes disappears or we forget to add the widget Meta .

Offer multi-language information

Several times it was commented on the blog and also in the forum about offering two languages ​​in the same blog. But if your interest is just cite a paragraph or frace in a language other than the original or you want to learn more about the language settings you can read those links, they may be useful to you.

] The entry Offer multi-language information was first published in WordPress Help .