| Server IP : 216.238.66.20 / Your IP : 216.73.217.142 Web Server : nginx/1.30.4 System : Linux woropds 5.15.0-187-generic #197-Ubuntu SMP Fri Jul 17 19:17:01 UTC 2026 x86_64 User : root ( 0) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/ecocerowaste.com/htdocs/wp-content/themes/flexor-green/ |
Upload File : |
<?php
function gmx_get_categories() {
$args = [
'orderby' => 'name',
'order' => 'ASC'
];
$categories = get_categories( $args );
return $categories;
}
function gmx_get_random_posts_sidebar() {
$args = [
'post_type' => 'productos',
'orderby' => 'rand',
'posts_per_page' => 5
];
$query = new WP_Query($args);
ob_start();
if( $query->have_posts() ) {
while($query->have_posts()) {
$query->the_post();
?>
<div class="post-item clearfix">
<img src="<?php echo get_post_meta( get_the_ID(), 'imagen', true )['guid'] ?>" alt="">
<h4 class="word-breakable"><a href="<?php echo the_permalink() ?>"><?php the_title() ?></a></h4>
</div>
<?php
wp_reset_postdata( );
}
}
$html = ob_get_clean();
return $html;
}
function gmx_show_products_on_category( $query ) {
if( is_category() || is_tag() && empty($query->query_vars['suppress_filters'])) {
$query->set('post_type', [
'productos',
'nav_menu_item'
]);
}
return $query;
}
function add_category_parent_css($css_classes, $category, $depth, $args){
if($args['has_children']){
$css_classes[] = 'drop-down';
}
return $css_classes;
}
//Remove Gutenberg Block Library CSS from loading on the frontend
function smartwp_remove_wp_block_library_css(){
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS
}
function gxm_register_theme_menu() {
register_nav_menu('main-menu', __( 'Menu Principal' ));
}
function gmx_add_category_meta_tags () {
if (is_category()) {
$category = get_queried_object();
$args = [
'post_type' => 'productos',
'orderby' => 'rand',
'posts_per_page' => 1,
'category_name' => $category->name
];
$query = new WP_Query($args);
ob_start();
if( $query->have_posts() ) {
while($query->have_posts()) {
$query->the_post();
?>
<meta property="og:url" content="<?php echo get_category_link($category) ?>">
<meta property="og:type" content="article">
<meta property="og:title" content="<?php echo $category->name ?>">
<meta property="og:description" content="<?php echo $category->description ?>">
<meta property="og:image" content="<?php echo get_post_meta(get_the_ID(), 'imagen', true)['guid'] ?>">
<?php
}
wp_reset_postdata();
}
$html = ob_get_clean();
echo $html;
} else {
$args = [
'post_type' => 'productos',
'orderby' => 'rand',
'posts_per_page' => 1
];
$query = new WP_Query($args);
ob_start();
if( $query->have_posts() ) {
while($query->have_posts()) {
$query->the_post();
?>
<meta property="og:url" content="<?php echo home_url() ?>">
<meta property="og:type" content="website">
<meta property="og:title" content="<?php bloginfo('name') ?>">
<meta property="og:description" content="<?php bloginfo('description') ?>">
<meta property="og:image" content="<?php echo get_post_meta(get_the_ID(), 'imagen', true)['guid'] ?>">
<?php
}
wp_reset_postdata();
}
$html = ob_get_clean();
echo $html;
}
}
function gmx_register_scripts() {
wp_enqueue_script('bootstrap', 'https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js', ['jquery'], '4.0', true);
wp_enqueue_script('jquery.easing', get_stylesheet_directory_uri() . '/assets/vendor/jquery.easing/jquery.easing.min.js', ['jquery'], '1.0', true);
wp_enqueue_script('jquery.sticky', get_stylesheet_directory_uri() . '/assets/vendor/jquery-sticky/jquery.sticky.js', ['jquery'], '1.0', true);
wp_enqueue_script('site', get_stylesheet_directory_uri() . '/assets/js/main.js', ['jquery'], '1.0', true);
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'wc-block-style' ); // Remove WooCommerce block CSS
}
add_action( 'wp_head', 'gmx_add_category_meta_tags' );
add_action( 'init', 'gxm_register_theme_menu' );
add_filter( 'pre_get_posts', 'gmx_show_products_on_category' );
add_action( 'wp_enqueue_scripts', 'gmx_register_scripts', 100 );
add_filter( 'category_css_class', 'add_category_parent_css', 10, 4 );
add_filter( 'show_admin_bar', '__return_false' );
add_filter( 'jetpack_sharing_counts', '__return_false', 99 );
add_filter( 'jetpack_implode_frontend_css', '__return_false', 99 );
add_theme_support( 'custom-logo' );
add_theme_support( 'post-thumbnails' );