<?php
/**
* More Custom Functions
*
* @package GridFeel WordPress Theme
* @copyright Copyright (C) 2025 ThemesDNA
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
* @author ThemesDNA <themesdna@gmail.com>
*/

// Change excerpt more word
function gridfeel_excerpt_more($more) {
    if ( is_admin() ) {
        return $more;
    }
    return apply_filters( 'gridfeel_excerpt_more', '...' );
}
add_filter('excerpt_more', 'gridfeel_excerpt_more');

function gridfeel_grid_post_title_length() {
    $post_title_length_home = 6;
    if ( gridfeel_get_option('post_title_length_home') ) {
        $post_title_length_home = gridfeel_get_option('post_title_length_home');
    }
    return apply_filters( 'gridfeel_grid_post_title_length', $post_title_length_home );
}

if ( ! function_exists( 'wp_body_open' ) ) :
    /**
     * Fire the wp_body_open action.
     *
     * Added for backwards compatibility to support pre 5.2.0 WordPress versions.
     */
    function wp_body_open() { // phpcs:ignore WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedFunctionFound
        /**
         * Triggered after the opening <body> tag.
         */
        do_action( 'wp_body_open' ); // phpcs:ignore WPThemeReview.CoreFunctionality.PrefixAllGlobals.NonPrefixedHooknameFound
    }
endif;

function gridfeel_search_box_placeholder_text() {
    $placeholder_text = esc_html__( 'Enter your search keyword...', 'gridfeel' );
    if ( gridfeel_get_option('search_box_placeholder_text') ) {
        $placeholder_text = gridfeel_get_option('search_box_placeholder_text');
    }
    return apply_filters( 'gridfeel_search_box_placeholder_text', $placeholder_text );
}