Showing posts with label wordpress. Show all posts
Showing posts with label wordpress. Show all posts

Saturday, 2 May 2015

How do i remove a pre exising customizer setting in wordpress theme



add_action( 'customize_register', 'ruth_sherman_theme_customize_register' );
function ruth_sherman_theme_customize_register( $wp_customize ) {

$wp_customize->remove_control('header_image');
$wp_customize->remove_panel('widgets');

$wp_customize->remove_section('colors');
$wp_customize->remove_section('background_image');
$wp_customize->remove_section('static_front_page');

}

Monday, 9 February 2015

Get post between dates in wordpress




$args = array(
'posts_per_page'   => -1,
'order'            => 'DESC',
'post_type'        => 'post',
'post_status'      => 'publish',
'cat'          => 59,
'date_query'  => array(
array(
'after'     => array(
'year'    => 2015,
'month'   => 02,
'day' => 06,
'hour' => 10,
'minute'  => 28,
'second'  => 55,
),
'before'    => array(
'year'    => 2015,
'month'   => 02,
'day' => 09,
'hour' => 15,
'minute'  => 24,
'second'  => 01,
),
),
),
);

$query_result = new WP_Query($args);


User can access only own media in wordpress




add_filter( 'ajax_query_attachments_args', 'show_users_own_attachments', 1, 1 );

function show_users_own_attachments($query){
  $id = get_current_user_id();
  if( !current_user_can('manage_options') )
  $query['author'] = $id;
  return $query;
}