{"id":406,"date":"2017-03-13T17:44:10","date_gmt":"2017-03-13T16:44:10","guid":{"rendered":"https:\/\/codesavory.com\/demo\/?post_type=knowledgebase&#038;p=406"},"modified":"2020-04-22T16:46:41","modified_gmt":"2020-04-22T14:46:41","slug":"theme-functions","status":"publish","type":"knowledgebase","link":"https:\/\/basepresskb.com\/docs\/knowledge-base\/basepress-themes\/theme-functions\/","title":{"rendered":"Theme functions"},"content":{"rendered":"<p>Here you find all the theme functions that BasePress provides to use in knowledge base theme templates, in order to easily create a specific theme for your needs. There is a function for any aspect of the KB therefore you only have to concentrate on building the look you need. The plugin takes care of all queries and data management.<br \/>\nRead more about <a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/theme-functions\/\" target=\"_blank\" rel=\"noopener noreferrer\">WordPress Theme Functions<\/a>.<br \/>\nLook at this article if you only want to <a href=\"https:\/\/basepresskb.com\/docs\/knowledge-base\/basepress-themes\/customize-a-knowledge-base-theme\/\">customize a pre-made Basepress theme<\/a>.<\/p>\n<h2>BasePress Theme Functions:<\/h2>\n<ul>\n<li><b>basepress_is_single_kb()<\/b><br \/>\n<i>Returns true if BasePress is used in Single Knowledge Base mode. False if used as a multi knowledge base.<\/i><\/li>\n<li><b>basepress_kbs()<\/b><br \/>\n<i>This function should be called inside products.php file to retrieve an array of Knowledge Bases objects.<br \/>\n(BasePress was originally created for multiple products so the file where this function is used is still called products.php for backward compatibility)<br \/>\nEach Knowledge Base object will contain the following properties:<\/i><\/p>\n<pre>id\r\nname\r\nslug\r\npermalink\r\ndescription\r\nimage =&gt; url, width, height\r\n<\/pre>\n<\/li>\n<li><b>basepress_kb()<\/b><br \/>\n<i>Retrieves the current Knowledge Base. It returns a single Knowledge Base object like above.<\/i><\/li>\n<li><strong>basepress_choose_kb_btn_text()<br \/>\n<\/strong><em>This function is used to get the text for the button to choose the Knowledge Base<\/em><\/li>\n<li><b>basepress_sections()<\/b><br \/>\n<i>Retrieves the sections in an archive page. Returns an array of section objects. Each section object will contain the following properties:<\/i><\/p>\n<pre>id\r\nname\r\nslug\r\npermalink\r\ndescription\r\nicon\r\nimage =&gt; url, width, height\r\nposts_count\r\nposts\t=&gt; array()\r\n<\/pre>\n<p><i>The posts property contains an array of WP_Posts with an extra icon element added.<\/i><\/li>\n<li><b>basepress_subsection_style()<\/b><br \/>\n<i>Returns the sub-sections style for the current Knowledge Base. The returned value will be &#8216;list&#8217; or &#8216;boxed&#8217; according to what has been selected in the Knowledge Base editor.<\/i><\/li>\n<li><b>basepress_kb_cols()<\/b><br \/>\n<i>Echos the number of columns set in the options for the knowledge bases page.<\/i><\/li>\n<li><b>basepress_section_cols()<\/b><br \/>\n<i>Echos the number of columns set in the options for the sections page.<\/i><\/li>\n<li><b>basepress_show_section_icon()<\/b><br \/>\n<i>Returns whether section icons should be displayed or not according to options.<\/i><\/li>\n<li><b>basepress_show_post_icon()<\/b><br \/>\n<i>Returns whether post icons should be displayed or not according to options.<\/i><\/li>\n<li><b>basepress_get_post_meta_icons()<\/b><br \/>\n<i>Returns the array of post meta icons.<\/i><\/li>\n<li><b>basepress_post_icon( $post_id )<\/b><br \/>\n<i>Returns the post icon class(es) name if an icon has been selected for the post\u00a0 or the default icon if none has been selected for the post.<\/i><\/li>\n<li><b>basepress_get_post_meta( $post_id )<\/b><br \/>\n<i>Returns an array with all post meta data.<\/i><\/p>\n<pre>array(\r\n    'icon'\r\n    'views'\r\n    'score'\r\n    'votes'\r\n);\r\n<\/pre>\n<\/li>\n<li><b>basepress_show_section_post_count()<\/b><br \/>\n<i>Returns a true if the posts count should be rendered for the sections titles.<\/i><\/li>\n<li><strong>basepress_sidebar_position( $reverse = false )<\/strong><br \/>\nReturns a string with the sidebar position. Pass true to the function to get the opposite position.<\/li>\n<li><b>basepress_show_table_of_content()<\/b><br \/>\n<i>Returns true if the Table of Content should be displayed according to options.<\/i><\/li>\n<li><b>basepress_table_of_content_title()<\/b><br \/>\n<i>Renders the Table of Content title as specified in the options<\/i><\/li>\n<li><b>basepress_table_of_content()<\/b><br \/>\n<i>Renders the Table of Content.<\/i><\/li>\n<li><b>basepress_pagination()<\/b><br \/>\n<i>Renders the pagination for the current section.<\/i><\/li>\n<li><b>basepress_post_pagination()<\/b><br \/>\n<i>Renders the article pagination.<\/i><\/li>\n<li><b>basepress_show_adjacent_articles()<\/b><br \/>\n<i>Returns true if Previous and Next article links should be shown.<\/i><\/li>\n<li><b>basepress_prev_article()<\/b><br \/>\n<i>Return the previous article post object.<\/i><\/li>\n<li><b>basepress_next_article()<\/b><br \/>\n<i>Return the previous article post object.<\/i><\/li>\n<li><b>basepress_prev_article_text()<\/b><br \/>\n<i>Return the title to display on previous article link as per options.<\/i><\/li>\n<li><b>basepress_next_article_text()<\/b><br \/>\n<i>Return the title to display on next article link as per options.<\/i><\/li>\n<li><b>basepress_breadcrumbs()<\/b><br \/>\n<i>Renders the breadcrumbs.<\/i><\/li>\n<li><b>basepress_searchbar()<\/b><br \/>\n<i>Renders the knowledge base search bar.<\/i><\/li>\n<li><b>basepress_search_term()<\/b><br \/>\n<i>Returns the searched terms.<\/i><\/li>\n<li><b>basepress_search_page_title()<\/b><br \/>\n<i>Returns search result page title from the options.<\/i><\/li>\n<li><b>basepress_search_page_no_results_title()<\/b><br \/>\n<i>Returns search result page title from the options for searches without results.<\/i><\/li>\n<li><b>basepress_search_post_snippet()<\/b><br \/>\n<i>Echos the current post snippet for the search results page.<\/i><\/li>\n<li><b>basepress_restricted_notice()<\/b><br \/>\n<i>Return the restricted content notice as set in the options.<\/i><\/li>\n<li><b>basepress_show_restricted_teaser()<\/b><br \/>\n<i>Returns true if the restricted content teaser should be shown.<\/i><\/li>\n<li><b>basepress_article_teaser()<\/b><br \/>\n<i>Return the restricted content teaser.<\/i><\/li>\n<li><b>basepress_show_restricted_login()<\/b><br \/>\n<i>Returns true if the login form should be shown on restricted content.<\/i><\/li>\n<li><b>basepress_votes()<\/b><br \/>\n<i>Renders the voting items.<\/i><\/li>\n<li><b>basepress_get_template_part()<\/b><br \/>\n<i>Loads a template part into a template. This is a replacement of WordPress get_template_part() and works within BasePress templates.<\/i><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Here you find all the theme functions that BasePress provides to use in knowledge base theme templates, in order to easily create a specific theme for your needs. There is a function for any aspect of the KB therefore you only have to concentrate on building the look you need. The plugin takes care of [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"https:\/\/basepresskb.com\/docs\/knowledge-base\/basepress-themes\/theme-functions\/\">Read More&#8230;<span class=\"screen-reader-text\"> from Theme functions<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","template":"","knowledgebase_cat":[20],"knowledgebase_tag":[],"class_list":["post-406","knowledgebase","type-knowledgebase","status-publish","hentry","knowledgebase_cat-basepress-themes"],"_links":{"self":[{"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/knowledgebase\/406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/types\/knowledgebase"}],"author":[{"embeddable":true,"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/comments?post=406"}],"version-history":[{"count":2,"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/knowledgebase\/406\/revisions"}],"predecessor-version":[{"id":1441,"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/knowledgebase\/406\/revisions\/1441"}],"wp:attachment":[{"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/media?parent=406"}],"wp:term":[{"taxonomy":"knowledgebase_cat","embeddable":true,"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/knowledgebase_cat?post=406"},{"taxonomy":"knowledgebase_tag","embeddable":true,"href":"https:\/\/basepresskb.com\/docs\/wp-json\/wp\/v2\/knowledgebase_tag?post=406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}