Skip to content

Instantly share code, notes, and snippets.

View moabi's full-sized avatar
🎯
Focusing

David Fieffé moabi

🎯
Focusing
View GitHub Profile
@moabi
moabi / lockdown_WP.txt
Last active September 16, 2015 07:47
lockdown wordpress rights
<?php
/**
*
* Description : lockdown wordpress rights
* version 1.0
*
*/
$mode = '';
$path_rights = array(
array(
@moabi
moabi / gist:f207c7a0c5eb9310f07a
Created June 17, 2015 05:24
Redirect if only one post in category - wordpress
function stf_redirect_to_post(){
global $wp_query;
if( is_archive() && $wp_query->post_count == 1 ){
the_post();
$post_url = get_permalink();
// Redirect to post page
wp_redirect( $post_url );
}
}
add_action('template_redirect', 'stf_redirect_to_post');
@moabi
moabi / Wordpress menu widget
Created June 11, 2015 15:01
retrieve a menu and format it
/**
* MENU widget
*
*/
class menu_widget extends WP_Widget {
/**
* Register widget with WordPress.
*/
@moabi
moabi / twitter wordpress widget.php
Last active October 15, 2015 12:05
twitter wordpress widget - name edition
<?php
class Last_Tweets extends WP_Widget {
/**
* Register widget with WordPress.
*/
function __construct() {
parent::__construct(
'Last-post', // Base ID
__('Lyra Network - Last Tweets', 'twentyfifteen'), // Name