Skip to content

Instantly share code, notes, and snippets.

@jmarreros
Last active August 17, 2016 22:03
Show Gist options
  • Save jmarreros/9f6b28484ecf5ea8a4be25d8fef09919 to your computer and use it in GitHub Desktop.
Save jmarreros/9f6b28484ecf5ea8a4be25d8fef09919 to your computer and use it in GitHub Desktop.
<?php
/*
Hacemos referencia al archivo wp-blog-header.php para
que nuestro archivo incluya la funcionalidad de Wordpress
*/
define('WP_USE_THEMES', false);
require('../wp-blog-header.php');
?>
<!DOCTYPE html>
<html>
<head>
<title>Página carga funciones WordPress</title>
</head>
<body>
<div class="usuario">
<h3>- Estado Usuario :</h3>
<strong>
<?php
//Verificación si un usuario esta conectado
global $user_login;
if( $user_login ) {
echo 'usuario conectado ';
} else {
echo 'usuario no conectado';
}
?>
</strong>
</div> <!-- fin estado usuario -->
<div class="entradas">
<h3>- Entradas recientes</h3>
<?php
//Mostrar las tres entradas recientes
global $post;
$args = array( 'posts_per_page' => 3 );
$myposts = get_posts( $args );
foreach( $myposts as $post )
{
setup_postdata($post);
echo "<a href='".get_permalink()."'>";
echo get_the_title();
echo "</a>";
echo "<br/>";
} ?>
</div><!--fin entradas recientes-->
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment