403Webshell
Server IP : 10.200.247.200  /  Your IP : 216.73.217.19
Web Server : Apache
System : Linux synergy-usa-sites 6.8.0-138-generic #138-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 22:41:49 UTC 2026 x86_64
User : jeremy ( 1001)
PHP Version : 8.4.25
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/usa_sites/governmentgrants.us/wp-content/themes/governmentgrantsus/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/usa_sites/governmentgrants.us/wp-content/themes/governmentgrantsus/functions.php
<?php
/**
 * Functions and definitions
 *
 * @link https://developer.wordpress.org/themes/basics/theme-functions/
 *
 * @package WordPress
 */
if ( ! function_exists( 'governmentgrantsus' ) ) {    
    function governmentgrantsus() {
        load_theme_textdomain('governmentgrantsus', get_template_directory() . '/languages');
        add_theme_support( 'woocommerce' );        
        add_theme_support( 'automatic-feed-links' );
        add_theme_support( 'post-thumbnails' );
        set_post_thumbnail_size( 1568, 9999 );
        add_theme_support( 'title-tag' );
        add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', 'style', 'script', 'navigation-widgets' ) );
        add_theme_support( 'post-formats', array( 'link', 'aside', 'gallery', 'image', 'quote', 'status', 'video', 'audio', 'chat'
        ) );
        add_post_type_support( 'page', 'excerpt' );

        register_nav_menus(
            array(
                'primary' => esc_html__( 'Primary menu', 'governmentgrantsus' ),
                'footer'  => __( 'Secondary menu', 'governmentgrantsus' ),
            )
        );   

        $logo_width  = 300;
        $logo_height = 60;
        add_theme_support(
            'custom-logo',
            array(
                'height'               => $logo_height,
                'width'                => $logo_width,
                'flex-width'           => true,
                'flex-height'          => true
            )
        );    

        // Add theme support for selective refresh for widgets.
        add_theme_support( 'customize-selective-refresh-widgets' );
        // Add support for Block Styles.
        add_theme_support( 'wp-block-styles' );
        // Add support for full and wide align images.
        add_theme_support( 'align-wide' );
        // Add support for editor styles.
        add_theme_support( 'editor-styles' );
        add_theme_support( 'widgets' );
        add_theme_support( 'widgets-block-editor' );
        add_theme_support( 'featured-content' );
        add_theme_support( 'admin-bar' );

        // Custom background color.
        add_theme_support(
            'custom-background',
            array(
                'default-color' => 'd1e4dd',
            )
        );

        // Editor color palette.
        $black     = '#000000';
        $dark_gray = '#28303D';
        $gray      = '#39414D';
        $green     = '#D1E4DD';
        $blue      = '#D1DFE4';
        $purple    = '#D1D1E4';
        $red       = '#E4D1D1';
        $orange    = '#E4DAD1';
        $yellow    = '#EEEADD';
        $white     = '#FFFFFF';

        add_theme_support(
            'editor-color-palette',
            array(
                array(
                    'name'  => esc_html__( 'Black', 'governmentgrantsus' ),
                    'slug'  => 'black',
                    'color' => $black,
                ),
                array(
                    'name'  => esc_html__( 'Dark gray', 'governmentgrantsus' ),
                    'slug'  => 'dark-gray',
                    'color' => $dark_gray,
                ),
                array(
                    'name'  => esc_html__( 'Gray', 'governmentgrantsus' ),
                    'slug'  => 'gray',
                    'color' => $gray,
                ),
                array(
                    'name'  => esc_html__( 'Green', 'governmentgrantsus' ),
                    'slug'  => 'green',
                    'color' => $green,
                ),
                array(
                    'name'  => esc_html__( 'Blue', 'governmentgrantsus' ),
                    'slug'  => 'blue',
                    'color' => $blue,
                ),
                array(
                    'name'  => esc_html__( 'Purple', 'governmentgrantsus' ),
                    'slug'  => 'purple',
                    'color' => $purple,
                ),
                array(
                    'name'  => esc_html__( 'Red', 'governmentgrantsus' ),
                    'slug'  => 'red',
                    'color' => $red,
                ),
                array(
                    'name'  => esc_html__( 'Orange', 'governmentgrantsus' ),
                    'slug'  => 'orange',
                    'color' => $orange,
                ),
                array(
                    'name'  => esc_html__( 'Yellow', 'governmentgrantsus' ),
                    'slug'  => 'yellow',
                    'color' => $yellow,
                ),
                array(
                    'name'  => esc_html__( 'White', 'governmentgrantsus' ),
                    'slug'  => 'white',
                    'color' => $white,
                ),
            )
        );
        add_theme_support(
            'editor-gradient-presets',
            array(
                array(
                    'name'     => esc_html__( 'Purple to yellow', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $yellow . ' 100%)',
                    'slug'     => 'purple-to-yellow',
                ),
                array(
                    'name'     => esc_html__( 'Yellow to purple', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $purple . ' 100%)',
                    'slug'     => 'yellow-to-purple',
                ),
                array(
                    'name'     => esc_html__( 'Green to yellow', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $green . ' 0%, ' . $yellow . ' 100%)',
                    'slug'     => 'green-to-yellow',
                ),
                array(
                    'name'     => esc_html__( 'Yellow to green', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $green . ' 100%)',
                    'slug'     => 'yellow-to-green',
                ),
                array(
                    'name'     => esc_html__( 'Red to yellow', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $yellow . ' 100%)',
                    'slug'     => 'red-to-yellow',
                ),
                array(
                    'name'     => esc_html__( 'Yellow to red', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $yellow . ' 0%, ' . $red . ' 100%)',
                    'slug'     => 'yellow-to-red',
                ),
                array(
                    'name'     => esc_html__( 'Purple to red', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $purple . ' 0%, ' . $red . ' 100%)',
                    'slug'     => 'purple-to-red',
                ),
                array(
                    'name'     => esc_html__( 'Red to purple', 'governmentgrantsus' ),
                    'gradient' => 'linear-gradient(160deg, ' . $red . ' 0%, ' . $purple . ' 100%)',
                    'slug'     => 'red-to-purple',
                ),
            )
        );      
   
        // Add support for responsive embedded content.
        add_theme_support( 'responsive-embeds' );
        // Add support for custom line height controls.
        add_theme_support( 'custom-line-height' );
        // Add support for experimental link color control.
        add_theme_support( 'experimental-link-color' );
        // Add support for experimental cover block spacing.
        add_theme_support( 'custom-spacing' );
        // Add support for custom units.
        // This was removed in WordPress 5.6 but is still required to properly support WP 5.5.
        add_theme_support( 'custom-units' );
    }
}
add_action( 'after_setup_theme', 'governmentgrantsus' );

/**
 * Addd support for svg image upload
 *
 * @since Government Grants US 1.0
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 *
 * @return void
 */
function cc_mime_types($mimes) {
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');

/**
 * Register widget area.
 *
 * @since Government Grants US 1.0
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 *
 * @return void
 */
function governmentgrantsus_widgets_init() {
	register_sidebar( array(
		'name'          => __( 'Blog Sidebar', 'governmentgrantsus' ),
		'id'            => 'blog-sidebar',
		'description'   => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'governmentgrantsus' ),
		'before_widget' => '<section id="%1$s" class="widget %2$s">',
		'after_widget'  => '</section>',
		'before_title'  => '<h4 class="widget-title">',
		'after_title'   => '</h4>',
	) );

	register_sidebar( array(
		'name'          => __( 'Home Business Grants Middle Footer', 'governmentgrantsus' ),
		'id'            => 'sidebar-1',
		'description'   => __( 'Add widgets here to appear in home page Business Grants Footer.', 'governmentgrantsus' ),
		'before_widget' => '<div id="%1$s" class="serviceList %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h4 class="widget-title">',
		'after_title'   => '</h4>',
	) );

	register_sidebar( array(
		'name'          => __( 'Home Personal Assistance Middle Footer', 'governmentgrantsus' ),
		'id'            => 'sidebar-2',
		'description'   => __( 'Add widgets here to appear in home page Personal Assistance Footer.', 'governmentgrantsus' ),
		'before_widget' => '<div id="%1$s" class="serviceList %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h4 class="widget-title">',
		'after_title'   => '</h4>',
	) );
    register_sidebar( array(
		'name'          => __( 'Home Housing Grants Middle Footer', 'governmentgrantsus' ),
		'id'            => 'sidebar-3',
		'description'   => __( 'Add widgets here to appear in Housing Grants Footer.', 'governmentgrantsus' ),
		'before_widget' => '<div id="%1$s" class="serviceList %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h4 class="widget-title">',
		'after_title'   => '</h4>',
	) );
	register_sidebar( array(
		'name'          => __( 'Home Education/Tuition Middle Footer', 'governmentgrantsus' ),
		'id'            => 'sidebar-4',
		'description'   => __( 'Add widgets here to appear in home page Education/Tuition Footer.', 'governmentgrantsus' ),
		'before_widget' => '<div id="%1$s" class="serviceList %2$s">',
		'after_widget'  => '</div>',
		'before_title'  => '<h4 class="widget-title">',
		'after_title'   => '</h4>',
	) );
	register_sidebar( array(
		'name'          => __( 'Footer About', 'governmentgrantsus' ),
		'id'            => 'sidebar-5',
		'description'   => __( 'Add widgets here to appear in footer about.', 'governmentgrantsus' )		
	) );
	 
}
add_action( 'widgets_init', 'governmentgrantsus_widgets_init' );

/**
 * How It Work Custom Post type start
 *
 * @since Government Grants US 1.0
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 *
 * @return void
 */

function post_type_how_it_work() {
  $supports = array('title','editor','author','thumbnail','excerpt','custom-fields');
  $labels = array(
      'name'           => _x('How It Work', 'plural'),
      'singular_name'  => _x('How It Work', 'singular'),
      'menu_name'      => _x('Home How It Work', 'admin menu'),
      'name_admin_bar' => _x('How It Work', 'admin bar'),
      'add_new'        => _x('Add New', 'add new'),
      'add_new_item'   => __('Add New How It Work'),
      'new_item'       => __('New How It Work'),
      'edit_item'      => __('Edit How It Work'),
      'view_item'      => __('View How It Work'),
      'all_items'      => __('All How It Work'),
      'search_items'   => __('Search How It Work'),
      'not_found'      => __('Not found.')
  );

  $args = array(
        'supports'            => $supports,
        'labels'              => $labels,       
        'query_var'           => true,    
        'hierarchical'        => false,
        'public'              => false,
        'publicly_queryable'  => true,
        'show_ui'             => true,
        'exclude_from_search' => true,
        'show_in_nav_menus'   => false,
        'has_archive'         => false,
        'rewrite'             => false
    );
  register_post_type('how-it-work', $args);
}
add_action('init', 'post_type_how_it_work');

function how_it_work_row_actions( $actions ){
    if( get_post_type() === 'how-it-work' ){
        unset( $actions['view'] );
    }
    return $actions;
}
add_filter( 'post_row_actions', 'how_it_work_row_actions', 10, 2 );

function howitwork_updated_messages( $messages ) {
if( get_post_type() === 'how-it-work' ){
$messages['how-it-work'] = array(0 => '',1 => 'How It Work Updated',6 => 'How It Work Added');
}
return $messages;
}
add_filter('post_updated_messages', 'howitwork_updated_messages');

/**
 * documentationpdf Custom Post type start
 *
 * @since Government Grants US 1.0
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 *
 * @return void
 */

function post_type_documentation() {
  $supports = array('title','editor','author','thumbnail','excerpt','custom-fields');
  $labels = array(
      'name'           => _x('Documentation PDF', 'plural'),
      'singular_name'  => _x('Documentation PDF', 'singular'),
      'menu_name'      => _x('Documentation PDF', 'admin menu'),
      'name_admin_bar' => _x('Documentation PDF', 'admin bar'),
      'add_new'        => _x('Add New', 'add new'),
      'add_new_item'   => __('Add New Documentation'),
      'new_item'       => __('New Documentation'),
      'edit_item'      => __('Edit Documentation PDF'),
      'view_item'      => __('View Documentation PDF'),
      'all_items'      => __('All Documentation PDF'),
      'search_items'   => __('Search Documentation PDF'),
      'not_found'      => __('Not found.')
  );

  $args = array(
        'supports'            => $supports,
        'labels'              => $labels,       
        'query_var'           => true,    
        'hierarchical'        => false,
        'public'              => false,
        'publicly_queryable'  => true,
        'show_ui'             => true,
        'exclude_from_search' => true,
        'show_in_nav_menus'   => false,
        'has_archive'         => false,
        'rewrite'             => false
    );
  register_post_type('documentation-pdf', $args);
}
add_action('init', 'post_type_documentation');

function documentation_row_actions( $actions ){
    if( get_post_type() === 'documentation-pdf' ){
        unset( $actions['view'] );
    }
    return $actions;
}
add_filter( 'post_row_actions', 'documentation_row_actions', 10, 2 );

function documentation_messages( $messages ) {
if( get_post_type() === 'documentation-pdf' ){
$messages['documentation-pdf'] = array(0 => '',1 => 'Documentation Updated',6 => 'Documentation Added');
}
return $messages;
}
add_filter('post_updated_messages', 'documentation_messages');

/**
 * Replaces "[...]" (appended to automatically generated excerpts) with ... and
 * a 'Continue reading' link.
 *
 * @since Government Grants US 1.0
 *
 * @param string $link Link to single post/page.
 * @return string 'Continue reading' link prepended with an ellipsis.
 */
function governmentgrantsus_excerpt_more( $link ) {
	if ( is_admin() ) {
		return $link;
	}
	$link = sprintf( '<p class="link-more"><a href="%1$s" class="more-link">%2$s</a></p>',
		esc_url( get_permalink( get_the_ID() ) ),
		/* translators: %s: Name of current post */
		sprintf( __( 'Read More<span class="screen-reader-text"> "%s"</span>', 'governmentgrantsus' ), get_the_title( get_the_ID() ) )
	);
	return ' &hellip; ' . $link;
}
add_filter( 'excerpt_more', 'governmentgrantsus_excerpt_more' );

/**
 * Add a pingback url auto-discovery header for singularly identifiable articles.
 *
 * @since Government Grants US 1.0
 *
 * @return void
 */

function governmentgrantsus_pingback_header() {
	if ( is_singular() && pings_open() ) {
		printf( '<link rel="pingback" href="%s">' . "\n", get_bloginfo( 'pingback_url' ) );
	}
}
add_action( 'wp_head', 'governmentgrantsus_pingback_header' );

/**
 * Page Slug Body Class
 *
 * @since Government Grants US 1.0
 *
 * @return void
 */

function government_add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_name . '-' . $post->post_type;
}
return $classes;
}
add_filter( 'body_class', 'government_add_slug_body_class' );


/**
 * Add "is-IE" class to body if the user is on Internet Explorer.
 *
 * @since Government Grants US 1.0
 *
 * @return void
 */
function governmentgrantsus_add_ie_class() {
    ?>
    <script>
    if ( -1 !== navigator.userAgent.indexOf( 'MSIE' ) || -1 !== navigator.appVersion.indexOf( 'Trident/' ) ) {
        document.body.classList.add( 'is-IE' );
    }
    </script>
    <?php
}
add_action( 'wp_footer', 'governmentgrantsus_add_ie_class' );

/**
 * Redirect Error page to Custom Page
 *
 * @since Government Grants US 1.0
 *
 * @return void
 */
add_action( 'template_redirect', 'redreict_to_custom_404_page' );
function redreict_to_custom_404_page(){
    if( is_404()  ){
        wp_redirect( home_url( '/page-not-found/' ) );
        exit();
    }
}

/**
 * remove p and br tags from default wordpress editor
 *
 * @since Government Grants US 1.0
 *
 * @return void
 */
// 
remove_filter( 'the_content', 'wpautop' );
remove_filter('widget_text_content', 'wpautop');
/**
 * Enable the use of shortcodes in text widgets.
 *
 * @since Government Grants US 1.0
 *
 * @return void
 */
add_filter( 'widget_text', 'shortcode_unautop');
add_filter( 'widget_text', 'do_shortcode');

/**
 * Services Offered Custom Post type start
 *
 * @since Government Grants US 1.0
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 *
 * @return void
 */

function post_services_offered() {
  $supports = array('title','editor','author','thumbnail','excerpt','custom-fields');
  $labels = array(
      'name'           => _x('Services Offered', 'plural'),
      'singular_name'  => _x('Services Offered', 'singular'),
      'menu_name'      => _x('Services Offered', 'admin menu'),
      'name_admin_bar' => _x('Services Offered', 'admin bar'),
      'add_new'        => _x('Add New', 'add new'),
      'add_new_item'   => __('Add New Service'),
      'new_item'       => __('New Services Offered'),
      'edit_item'      => __('Edit Service'),
      'view_item'      => __('View Services Offered'),
      'all_items'      => __('All Services Offered'),
      'search_items'   => __('Search Services Offered'),
      'not_found'      => __('Not found.')
  );

  $args = array(
        'supports'            => $supports,
        'labels'              => $labels,       
        'query_var'           => true,    
        'hierarchical'        => false,
        'public'              => false,
        'publicly_queryable'  => false,
        'show_ui'             => true,
        'exclude_from_search' => true,
        'show_in_nav_menus'   => false,
        'has_archive'         => false,
        'rewrite'             => false
    );
  register_post_type('services-offered', $args);
}
add_action('init', 'post_services_offered');

function services_offered_row( $actions ){
    if( get_post_type() === 'services-offered' ){
        unset( $actions['view'] );
    }
    return $actions;
}
add_filter( 'post_row_actions', 'services_offered_row', 10, 2 );

function services_offered_messages( $messages ) {
if( get_post_type() === 'services-offered' ){
$messages['services-offered'] = array(0 => '',1 => 'Service Updated',6 => 'Service Added');
}
return $messages;
}
add_filter('post_updated_messages', 'services_offered_messages');
?>

Youez - 2016 - github.com/yon3zu
LinuXploit