Skip to content

Instantly share code, notes, and snippets.

@deryckoe
Last active February 15, 2017 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deryckoe/d0018ce9a66de44159b7d2d06c689214 to your computer and use it in GitHub Desktop.
Save deryckoe/d0018ce9a66de44159b7d2d06c689214 to your computer and use it in GitHub Desktop.
WP Expertos/60/add_action
<?php add_action( 'hook', 'funcion', $prioridad, $argumentos ); ?>
<?php add_filter( 'hook', 'funcion', $prioridad, $argumentos ); ?>
<?php
add_action( 'the_title', 'print_c', 30, 2 );
add_action( 'the_title', 'print_b', 20, 2 );
add_action( 'the_title', 'print_a', 10, 2 );
function print_c($title, $post_id) {
$title .= 'Press';
return $title;
}
function print_b($title, $post_id) {
$title .= 'Word';
return $title;
}
function print_a($title, $post_id) {
$title = '';
return $title;
}
?>
<?php
add_filter( 'wp_title', 'hack_wp_title' );
function hack_wp_title( $title )
{
if ( empty( $title ) && ( is_home() || is_front_page() ) ) {
$title = get_bloginfo('name') . ' | ' . get_bloginfo('description');
} elseif ( is_archive() ) {
$title = get_bloginfo( 'name' ) . ' | Archivo:' . get_the_archive_title() );
} else {
$title = get_bloginfo( 'name' ) . ' | ' . get_the_title( get_the_ID() );
}
return $title;
} ?>
<?php
add_action( 'login_enqueue_scripts', 'login_logo' );
function login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/assets/img/logo.png);
background-size: 100%;
width: 155px;
height: 55px;
padding-bottom: 0px;
}
</style> <?php
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment