[wp-hackers] Custom DB Table Settings

Joan Artés jartes at gmail.com
Tue Jan 22 19:57:55 UTC 2013


Hi,

To change the post count I used this code:

function modify_post_per_page( $query ) {
    $query->query_vars['posts_per_page'] = 12;
    return $query;
}

add_filter( 'pre_get_posts', modify_post_per_page' );

Cheers

Joan Artés
http://joanartes.com


2013/1/22 Sinan <sinan at sinanisler.com>

> I'm writing a theme its need special settings.
> one them is post per page count. As you know it is 10 but I have set this
> at the beggining to 12 I write this for to do that setting
>
>
> add_action( 'after_setup_theme', 'function_name' );
> $wpdb->query(
> "
> UPDATE  `wp`.`*wpsinshop*_options`
>  SET  `option_value` =  '*12*'
> WHERE  `*wpsinshop*_options`.`option_id` =22;
>  "
> );
>
> *wpsinshop *custom db prefix. How can I can make this setting better or
> easy way? Or if this way is better how can I get db prefix for update it.
> As you know some times prefix changing and if I make default wp_ prefix
> this setting some times not gonna work.
>
>
> Thanks.
>
> --
> Sinan İŞLER
> sinanisler.com <http://www.sinanisler.com>
> fb.com/sinanisler
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list