{"id":53,"date":"2026-04-26T19:15:55","date_gmt":"2026-04-26T19:15:55","guid":{"rendered":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/2026\/04\/26\/customizing-and-hooks\/"},"modified":"2026-04-26T19:15:55","modified_gmt":"2026-04-26T19:15:55","slug":"customizing-and-hooks","status":"publish","type":"post","link":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/2026\/04\/26\/customizing-and-hooks\/","title":{"rendered":"Customizing &#038; Hooks"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Customizing &#038; Hooks<\/h1>\n\n\n<p>For developers extending Best Classifieds. Reference list of every action and filter the theme + Pro plugin expose, plus the recommended customization pattern (child theme or small custom plugin).<\/p>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Recommended approach<\/h2>\n\n\n<h3 class=\"wp-block-heading\">Don&#8217;t edit the theme directly<\/h3>\n\n\n<p>Edits to <code>\/wp-content\/themes\/best-classifieds\/<\/code> get wiped when the theme updates. Use one of these instead:<\/p>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Pattern<\/th>\n<th>When to use<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><strong>Child theme<\/strong><\/td>\n<td>You&#8217;re overriding template files (single.php, archive.php, etc.) or adding template-parts<\/td>\n<\/tr>\n<tr>\n<td><strong>Small custom plugin<\/strong><\/td>\n<td>You&#8217;re adding hooks, filters, custom post types, REST endpoints. Most customizations belong here.<\/td>\n<\/tr>\n<tr>\n<td><strong>Code Snippets plugin<\/strong><\/td>\n<td>One-off filter tweaks, no version control needed<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n\n<h3 class=\"wp-block-heading\">Child theme starter<\/h3>\n\n\n<pre class=\"wp-block-code\"><code>\/wp-content\/themes\/best-classifieds-child\/\n\u251c\u2500\u2500 style.css         (Template: best-classifieds)\n\u251c\u2500\u2500 functions.php     (load parent&#039;s main stylesheet)\n\u2514\u2500\u2500 single.php        (your override; copy from parent and edit)<\/code><\/pre>\n\n\n<p><code>style.css<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>\/*\nTheme Name:  Best Classifieds Child\nTemplate:    best-classifieds\nVersion:     1.0.0\n*\/<\/code><\/pre>\n\n\n<p><code>functions.php<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nadd_action( &#039;wp_enqueue_scripts&#039;, function() {\n    wp_enqueue_style( &#039;best-classifieds-parent&#039;, get_template_directory_uri() . &#039;\/style.css&#039; );\n} );<\/code><\/pre>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Theme action hooks<\/h2>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Hook<\/th>\n<th>Position<\/th>\n<th>Args<\/th>\n<th>Purpose<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>best_classifieds_before_header<\/code><\/td>\n<td>Before site header<\/td>\n<td>\u2014<\/td>\n<td>Inject announcement bars<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_header<\/code><\/td>\n<td>After site header<\/td>\n<td>\u2014<\/td>\n<td>Inject sticky promos<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_card_image<\/code><\/td>\n<td>After listing card image<\/td>\n<td><code>$post_id<\/code><\/td>\n<td>Add badges to cards (Pro adds Featured\/Verified)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_card_meta<\/code><\/td>\n<td>After listing card meta<\/td>\n<td><code>$post_id<\/code><\/td>\n<td>Add favorite button (Pro does this)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_listing_image<\/code><\/td>\n<td>After single listing&#8217;s main image<\/td>\n<td><code>$post_id<\/code><\/td>\n<td>Add gallery thumbnails (Pro)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_listing_content<\/code><\/td>\n<td>After single listing&#8217;s description<\/td>\n<td><code>$post_id<\/code><\/td>\n<td>Add map, similar listings (Pro)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_listing_sidebar<\/code><\/td>\n<td>After single listing&#8217;s sidebar info card<\/td>\n<td><code>$post_id<\/code><\/td>\n<td>Add messaging widget, reviews (Pro)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_listing_actions<\/code><\/td>\n<td>Inside sidebar info card<\/td>\n<td><code>$post_id<\/code><\/td>\n<td>Replace default contact buttons (Pro adds Message Seller)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_before_footer<\/code><\/td>\n<td>Before site footer<\/td>\n<td>\u2014<\/td>\n<td>Inject newsletter signup, ad slots<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Theme filters<\/h2>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Filter<\/th>\n<th>Default<\/th>\n<th>Purpose<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>best_classifieds_listing_post_type<\/code><\/td>\n<td><code>post<\/code><\/td>\n<td>Override the post type used for listings<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_listings_category_slug<\/code><\/td>\n<td><code>listings<\/code><\/td>\n<td>Slug of the parent &#8220;Listings&#8221; category<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_post_ad_url<\/code><\/td>\n<td>customizer value<\/td>\n<td>The &#8220;Post Free Ad&#8221; button URL (Pro filters this)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_pro_active<\/code><\/td>\n<td>false<\/td>\n<td>True if a Pro license is active (Pro overrides)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_is_listing<\/code><\/td>\n<td>derived<\/td>\n<td>Whether a given post should be rendered as a listing<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_price_html<\/code><\/td>\n<td>formatted<\/td>\n<td>Final HTML for the price display<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_currency_code<\/code><\/td>\n<td><code>USD<\/code><\/td>\n<td>ISO currency code for schema.org JSON-LD<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_currency_symbol<\/code><\/td>\n<td><code>$<\/code><\/td>\n<td>Symbol used in price formatting<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_color_palettes<\/code><\/td>\n<td>2 palettes<\/td>\n<td>Add custom palettes<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_category_icon<\/code><\/td>\n<td>mapping<\/td>\n<td>Per-slug Tabler icon<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_smart_icon_keywords<\/code><\/td>\n<td>mapping<\/td>\n<td>Keyword \u2192 icon for smart search results<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_search_post_types<\/code><\/td>\n<td>listing PT<\/td>\n<td>Post types included in live search<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_search_listings_limit<\/code><\/td>\n<td>8<\/td>\n<td>Listings returned by live search<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_search_categories_limit<\/code><\/td>\n<td>4<\/td>\n<td>Categories returned by live search<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_homepage_categories_args<\/code><\/td>\n<td>get_terms args<\/td>\n<td>Modify the homepage Categories grid query<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Pro plugin filters<\/h2>\n\n\n<figure class=\"wp-block-table\"><table>\n<thead><tr>\n<th>Filter<\/th>\n<th>Purpose<\/th>\n<\/tr><\/thead><tbody>\n<tr>\n<td><code>best_classifieds_submission_post_args<\/code><\/td>\n<td>Modify post args before insert (frontend submission)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_submission_validate<\/code><\/td>\n<td>Add custom validation rules<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_submission_locked_fields<\/code><\/td>\n<td>Lock fields after publish<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_after_submission<\/code><\/td>\n<td>React to a successful submission (action)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_dashboard_tabs<\/code><\/td>\n<td>Add\/remove dashboard tabs<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_visible_custom_fields<\/code><\/td>\n<td>Filter which custom fields render<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_render_custom_field<\/code><\/td>\n<td>Custom HTML for a specific field<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_message_strip_patterns<\/code><\/td>\n<td>Regex patterns to strip from messages<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_payment_gateways<\/code><\/td>\n<td>Register new gateways (PayPal, Square, etc.)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_payment_amount<\/code><\/td>\n<td>Modify amount before charge (taxes, discounts)<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_use_pro_reviews<\/code><\/td>\n<td>Force standard comments instead of Pro reviews<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_similar_listings_count<\/code><\/td>\n<td>How many similar listings to show<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_map_zoom<\/code><\/td>\n<td>OSM map default zoom<\/td>\n<\/tr>\n<tr>\n<td><code>best_classifieds_map_tile_url<\/code><\/td>\n<td>OSM tile server URL<\/td>\n<\/tr>\n<\/tbody><\/table><\/figure>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Common customization recipes<\/h2>\n\n\n<h3 class=\"wp-block-heading\">Add a custom badge to listings<\/h3>\n\n\n<pre class=\"wp-block-code\"><code>add_action( &#039;best_classifieds_after_card_image&#039;, function( $post_id ) {\n    if ( get_post_meta( $post_id, &#039;_certified_dealer&#039;, true ) ) {\n        echo &#039;&lt;span class=&quot;bc-badge bc-badge-certified&quot;&gt;Certified Dealer&lt;\/span&gt;&#039;;\n    }\n} );<\/code><\/pre>\n\n\n<p>Style it via your child theme&#8217;s CSS.<\/p>\n\n\n<h3 class=\"wp-block-heading\">Force a category for new submissions<\/h3>\n\n\n<pre class=\"wp-block-code\"><code>add_filter( &#039;best_classifieds_submission_post_args&#039;, function( $args, $data ) {\n    \/\/ Auto-tag everything submitted on Mondays as &quot;weekly-special&quot;\n    if ( 1 === (int) date( &#039;N&#039; ) ) {\n        $args[&#039;tax_input&#039;][&#039;post_tag&#039;] = array( &#039;weekly-special&#039; );\n    }\n    return $args;\n}, 10, 2 );<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Add a third color palette<\/h3>\n\n\n<pre class=\"wp-block-code\"><code>add_filter( &#039;best_classifieds_color_palettes&#039;, function( $palettes ) {\n    $palettes[&#039;ocean-blue&#039;] = array(\n        &#039;label&#039;      =&gt; &#039;Ocean Blue&#039;,\n        &#039;primary&#039;    =&gt; &#039;#1E3A8A&#039;,\n        &#039;accent&#039;     =&gt; &#039;#06B6D4&#039;,\n        &#039;background&#039; =&gt; &#039;#F0F9FF&#039;,\n        &#039;text&#039;       =&gt; &#039;#0F172A&#039;,\n    );\n    return $palettes;\n} );<\/code><\/pre>\n\n\n<p>The new palette appears in the customizer dropdown automatically.<\/p>\n\n\n<h3 class=\"wp-block-heading\">Inject a banner above the homepage hero<\/h3>\n\n\n<pre class=\"wp-block-code\"><code>add_action( &#039;best_classifieds_before_header&#039;, function() {\n    if ( is_front_page() ) {\n        echo &#039;&lt;div class=&quot;bc-announcement&quot;&gt;Black Friday: 50% off Featured slots!&lt;\/div&gt;&#039;;\n    }\n} );<\/code><\/pre>\n\n\n<h3 class=\"wp-block-heading\">Restrict Featured upgrades to specific user roles<\/h3>\n\n\n<pre class=\"wp-block-code\"><code>add_filter( &#039;best_classifieds_packages_for_user&#039;, function( $packages, $user_id ) {\n    $user = get_user_by( &#039;id&#039;, $user_id );\n    if ( in_array( &#039;subscriber&#039;, $user-&gt;roles, true ) ) {\n        \/\/ Subscribers can&#039;t pay for Featured slots\n        unset( $packages[&#039;boosted&#039;], $packages[&#039;premium&#039;] );\n    }\n    return $packages;\n}, 10, 2 );<\/code><\/pre>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">Template overrides<\/h2>\n\n\n<p>To override a template part from a child theme, copy the file to the same path inside your child:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>\/wp-content\/themes\/best-classifieds-child\/template-parts\/hero.php<\/code><\/pre>\n\n\n<p>Best Classifieds checks the child theme first, then falls back to the parent. You can override any of:<\/p>\n\n\n<ul class=\"wp-block-list\">\n<li><code>template-parts\/hero.php<\/code><\/li>\n<li><code>template-parts\/featured-categories.php<\/code><\/li>\n<li><code>template-parts\/latest-listings.php<\/code><\/li>\n<li><code>template-parts\/cta-banner.php<\/code><\/li>\n<li><code>template-parts\/trust-strip.php<\/code><\/li>\n<li><code>template-parts\/how-it-works.php<\/code><\/li>\n<li><code>template-parts\/testimonial.php<\/code><\/li>\n<li><code>template-parts\/listing\/card.php<\/code><\/li>\n<li><code>template-parts\/content.php<\/code><\/li>\n<\/ul>\n\n\n<p>For top-level templates: <code>single.php<\/code>, <code>archive.php<\/code>, <code>index.php<\/code>, <code>header.php<\/code>, <code>footer.php<\/code> \u2014 same pattern.<\/p>\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n<h2 class=\"wp-block-heading\">REST API extension<\/h2>\n\n\n<p>The theme registers <code>\/wp-json\/best-classifieds\/v1\/search<\/code>. To add your own endpoint with the same namespace:<\/p>\n\n\n<pre class=\"wp-block-code\"><code>add_action( &#039;rest_api_init&#039;, function() {\n    register_rest_route( &#039;best-classifieds\/v1&#039;, &#039;\/popular&#039;, array(\n        &#039;methods&#039;             =&gt; &#039;GET&#039;,\n        &#039;permission_callback&#039; =&gt; &#039;__return_true&#039;,\n        &#039;callback&#039;            =&gt; function() {\n            $query = new WP_Query( array(\n                &#039;post_type&#039;      =&gt; &#039;post&#039;,\n                &#039;posts_per_page&#039; =&gt; 5,\n                &#039;meta_key&#039;       =&gt; &#039;_bc_views&#039;,\n                &#039;orderby&#039;        =&gt; &#039;meta_value_num&#039;,\n                &#039;order&#039;          =&gt; &#039;DESC&#039;,\n            ) );\n            $out = array();\n            foreach ( $query-&gt;posts as $p ) {\n                $out[] = array( &#039;id&#039; =&gt; $p-&gt;ID, &#039;title&#039; =&gt; $p-&gt;post_title );\n            }\n            return $out;\n        },\n    ) );\n} );<\/code><\/pre>\n\n\n<p>Hit <code>\/wp-json\/best-classifieds\/v1\/popular<\/code> to test.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For developers extending Best Classifieds. Reference list of every action and filter the theme + Pro plugin expose, plus the recommended customization pattern (child theme or small custom\u2026<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-53","post","type-post","status-publish","format-standard","hentry","category-reference"],"_links":{"self":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/posts\/53","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/comments?post=53"}],"version-history":[{"count":0,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/posts\/53\/revisions"}],"wp:attachment":[{"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/media?parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/categories?post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.fasterthemes.com\/best-classifieds-wordpress-theme\/wp-json\/wp\/v2\/tags?post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}