简体   繁体   中英

wordpress- trouble in function

I have a problem with this code:

<?php 
    if (is_home()) $args=array(
        'showposts'=> (int) get_option('13floor_homepage_posts'),
        'paged'=>$paged,
        'category__not_in' => (array) get_option('13floor_exlcats_recent'),
    ); 
?>

I am unable to find this term: 13floor_homepage_posts in the whole theme file. From the codex I have found about get_option

A safe way of getting values for a named option from the options database table. If the desired option does not exist, or no value is associated with it, FALSE will be returned."

After that I've searched in the wordpress database but could not find 13floor_homepage_posts and 13floor_exlcats_recent

Can anyone please explain this to me

Theget_option method in WordPress will query the {wp-prefix}_options table for a row with the key supplied, in your case '13floor_homepage_posts'. As you stated from the documentation if not found then FALSE is returned, this means if you queried your options table and did not find it then the response will be false. Which in the case of the code snippet you posted I assume will be running against a post query and the showposts parameter when set to false will show all posts. So if your theme has an admin console/configuration section I assume it will also have a way to set the value as a setting.

As an asside, considering the fact that the code is using showposts instead of its replacement posts_per_page I assume this theme might be a bit dated when it comes to the code and compatibility with newer versions of WordPress/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM