Wordpress SEO - What are you looking for?

If you're looking for answers to SEO or wordpress related questions, type in a phrase and wait for hints or click enter! The results also show links to external sources.

161 articles in the database

Some interesting pieces of code part 1

[ Article content is protected by Plagiashield ]

wp-code-snippet

With this post I begin a series of some useful snippetto make working with WP easier.

All of the following codes are added to the file functions.php znajdującego się w plikach używanego szablonu

Restricting the visibility of images in Media

Default, WordPress allows the author to view all images in the media library. By adding the code below, we will limit the visibility of the images to those that he added/uploaded himself.

function images_useronly( $wp_query ) {
 if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false ) {
 if ( !current_user_can( 'level_5' ) ) {
 global $current_user;
 $wp_query->set( 'author', $current_user->id );
  }
 }
}

add_filter('parse_query', 'images_useronly' );

2. highlighting the first post with a new css class

A standard application might be to style it as "Novelty" based on the .first .

add_filter( 'post_class', 'first_post_class' );
function first_post_class( $classes ) {
    global $wp_query;
    if( 0 == $wp_query->current_post )
        $classes[] = 'first';
        return $classes;
}

We change the name of the given class in 5 lines of code - currently "first"

3. adding a login form to the page/post

The code allows you to place using shortcode login form via WP text editor.

function page_login_form_shortcode() {
 if ( is_user_logged_in() )
 return '';
 return wp_login_form( array( 'echo' => false ) );
}
function page_add_shortcodes() {
 add_shortcode( 'page-login-form', 'page_login_form_shortcode' );
}

add_action( 'init', 'page_add_shortcodes' );

To display paste shortcode: page-login-form] in place of website/post where we want it to display form. The form is displayed only for those who are not logged in users.

4. placing the url to the image in the Media panel

The code makes it easy to work with images by adding to the media library:

url-image-media

function muc_column( $cols ) {
 $cols["media_url"] = "addressURL";
 return $cols;
}
function muc_value( $column_name, $id ) {
 if ( $column_name == "media_url" ) echo '';
}
add_filter( 'manage_media_columns', 'muc_column' );
add_action( 'manage_media_custom_column', 'muc_value', 10, 2 );
Wojciech Wladzinski

O Wojciech Wladzinski

I have been dealing with SEO industry since 2008. At co day senior SEO specialist in the company Seogroup. I create and optimize large websites like and smaller websites online. I am particularly fond of the environment WordPresswhich, despite popular belief, is not just a blogging platform.
  • Internal Links and Sematics

  • Link building
  • Sematics
  • Link building has never been easier. Hundreds of link possibilities in one click.
  • See

[ Article content is protected by Plagiashield ]

SEMRush - the best tool for SEO and PPC.

en_USEnglish
Read previous post:
freeebook2
How to build an SEO backend? Free help from SeoWay

A thriving theme portal, an online forum, a website directory or even an online store as an SEO backend? This is becoming an everyday arena....

Close