Forum Replies Created

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter pervez121

    (@pervez121)

    just and update

    i developed script that automatically manages phone input placeholders by first checking for phone fields on the page, then replacing the plugin’s lengthy example numbers with either a clean “Phone number” text or the selected country code, while actively monitoring user interactions like typing and country selection to maintain the correct placeholder display and prevent the default examples from reappearing during actions such as backspacing or form interactions.

    but this does not look a clen solution, there must be an option to manage this.

    Thread Starter pervez121

    (@pervez121)

    Hi there,

    Thanks again for your help — I’ve followed your approach and used a static page with the BetterDocs shortcodes, and that part is now working properly.

    However I’m still facing an issue specifically with the single doc page — it isn’t picking up the proper layout.
    Instead of using the BetterDocs layout, it’s falling back to author.php and shows the same list of posts that appear on the documentation archive/main page earlier.

    Is there anything we can do to force the single doc page to use the BetterDocs layout (or a specific template like layout-1.php)?

    Would really appreciate a little direction on that part as well.

    Thanks

    • This reply was modified 9 months, 2 weeks ago by pervez121.
    Thread Starter pervez121

    (@pervez121)

    Thank you so much for your help and for explaining the actual reason behind this.

    For now I’ve used a custom workaround — I created my own template for both the documentation archive and the single doc page and then loaded the BetterDocs shortcodes inside those templates by checking the /documentation slug.
    This helped me force the correct layout and avoid the author.php fallback.

    This is just a temporary custom fix so that things keep working on production — I’ll now set up a testing site and apply your suggested approach in a clean way.

    Thanks again for pointing me in the right direction 🙏

    Thread Starter pervez121

    (@pervez121)

    Hello,

    Thanks for the detailed response — it really helped me narrow things down. I checked the template being used for the documentation page and noticed that it’s loading author.php, However, I have the Built-in Page option enabled in BetterDocs General Settings.

    Is there a way to force BetterDocs to use the built-in documentation template for all pages, rather than author.php? Or could there be something in my setup that’s causing BetterDocs to fall back to the author.php template?

    Thanks.

    Forum: Plugins
    In reply to: [YMC Filter] child plugin
    Thread Starter pervez121

    (@pervez121)

    I see—yes, I lost the changes. I wanted to show the post count like this in Layout 4.
    Is there any hook available that would let me do this?

    Image link: https://tinyurl.com/22gxdycj

    • This reply was modified 1 year, 1 month ago by pervez121.
    Thread Starter pervez121

    (@pervez121)

    oh great, that really helped, thank you.

    Thread Starter pervez121

    (@pervez121)

    if you would add that count option in a new update that would be really cool.

    Thread Starter pervez121

    (@pervez121)

    Thank you so much, I resolved the jQuery error then disabled disable the Hierarchical Tree of Terms and now the filter is perfectly working

    Thread Starter pervez121

    (@pervez121)

    The filter did not worked for me so Ii customized the layout , here is what I did
    1: fetch the count of posts in each category using the term ID in the layout template and echo the count from where the term was printed

    $term_id = $object_term->term_id; // Get term ID
    $taxonomy = $object_term->taxonomy; // Get taxonomy (e.g., 'category')

    // WP_Query to count posts in this category
    $args = [
    'post_type' => 'post', // Change this if you need a custom post type
    'posts_per_page' => -1, // Get all posts
    'tax_query' => [
    [
    'taxonomy' => $taxonomy, // Use the taxonomy (e.g., 'category')
    'field' => 'term_id',
    'terms' => $term_id, // Get posts for this term ID
    ],
    ],
    ];

    $query = new WP_Query($args);
    $post_count = $query->found_posts; // Get count of posts
    wp_reset_postdata(); // Reset query

    // Use $post_count where you need to display it
    echo '<span class="category_count">'. esc_html($post_count) . '</span>';
    Thread Starter pervez121

    (@pervez121)

    Thanks for the clarification. However, the issue remains unresolved. I have correctly used the filter:

    add_filter('ymc_filter_custom_layout_169_1', 'custom_sidebar_filter', 10, 6);

    But the post count is not appearing in the sidebar filter. Can you confirm if this filter is correct for modifying the sidebar layout? Also, is there a specific way to retrieve the post count using the plugin’s query parameters?

    I’d appreciate any further guidance. Thanks!

    Thread Starter pervez121

    (@pervez121)

    Thanks for the reply! However, PHP requires straight quotes (') and not curly quotes (‘’). Using curly quotes is causing a syntax error.

    add_filter(‘ymc_filter_custom_layout_169_1’, ‘custom_sidebar_filter’, 10, 6);

    • This reply was modified 1 year, 3 months ago by pervez121.
    Thread Starter pervez121

    (@pervez121)

    I am using the Sidebar Layout and trying to add post count functionality to it.

    filter id: ymc_filter_custom_layout_169_1
    layout id: display_hello_world_layout_1

    Here is the code I am using:

    add_filter('ymc_filter_custom_layout_169_1_display_hello_world_layout_1', 'custom_sidebar_filter', 10, 6);

    function custom_sidebar_filter($output, $filter_id, $layout_id, $terms, $post_type, $taxonomy) {
    if (!empty($terms)) {
    $output = '<ul class="ymc-sidebar-filter">';
    foreach ($terms as $term) {
    $term_count = $term->count; // Get post count for each category
    $output .= '<li>';
    $output .= '<a href="' . get_term_link($term->term_id, $taxonomy) . '">' . $term->name . ' (' . $term_count . ')</a>';
    $output .= '</li>';
    }
    $output .= '</ul>';
    }
    return $output;
    }

    here is the page link: https://blue3.genetechz.com/enrich-kid-blog/

    • This reply was modified 1 year, 3 months ago by pervez121.
    Thread Starter pervez121

    (@pervez121)

    Thank you, it worked

Viewing 13 replies - 1 through 13 (of 13 total)