Latest posts(最新帖子) Page list(页面列表) RSS(简易资讯聚合) Search(搜索) Shortcode(短代码) Social icons(社交图标) Tag Cloud(标签云) 五、Theme Blocks(主题块) 大多数主题块都是动态的,会拉入内容信息,如帖子内容、查询循环和帖子评论,并将它们显示在站点上。其中几个对于展示网站身份也是必不可少的,...
functionrecent_posts_function($atts){extract(shortcode_atts(array('posts'=>1,),$atts));$return_string='';query_posts(array('orderby'=>'date','order'=>'DESC','showposts'=>$posts));if(have_posts()):while(have_posts()):the_post();$return_string.=''.get_the_title().'';endwh...
Footer Sidebars, Posts or Pages. Using shortcode you can customize the menu attributes. Also you can set your custom id or class to a menu. You can display ordered list menu as well.
Go beyond any standard WordPress shortcode plugin. Easily make a website using shortcodes, templates, snippets, custom post types, and more.
else $childpages = wp_list_pages( 'sort_column=menu_order&title_li=&child_of=' . $post->ID . '&echo=0' ); if ( $childpages ) { $string = '' . $childpages . '';} return $string; } add_shortcode('wpb_childpages', 'wpb_list_child_pages'); 上面的代码首先检查页面是否有...
WordPress函数:add_shortcode 添加短代码 函数原型: add_shortcode(string$tag,callable$callback) 添加新的短代码 应注意前缀或其他方式,以确保添加的短代码标签是唯一的,不会与其他已添加的短码标签冲突。如果标签重复,最后加载的标签将优先。 参数说明:
function my_related_products_shortcode() { // 获取当前产品的分类 $terms = wp_get_post_terms(get_the_ID(),'product_cat'); if(empty($terms))return'';// 如果没有分类,返回空 $term_ids = wp_list_pluck($terms,'term_id'); $args = array( ...
* * Possible shortcode attributes: * id (required) Form ID of which to show entries. * user User ID, or "current" to default to current logged in user. * fields Comma separated list of form field IDs. * number Number of entries to show, defaults to 30. * * @link wpforms.com/...
In the first two lines of theonclick()function, the user is prompted to input the parameters for the number of posts and list heading of the shortcode. Then, depending on the values of these parameters, the appropriate shortcode form is inserted in the editor. ...
The [mla_custom_list] shortcode, used in a post, page, custom post type or widget to display flat lists, dropdown controls and checkbox lists of custom field values. Twenty-seven hooks are provided for complete list customization from your theme or plugin code. Support for WPML and Polylang...