Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #115907
    Biacna
    Participant

    Hi, I am using The Events Calendar plugin with Clean Education theme. Unfortunately the plugin generates a lot of unwanted URLs. It was suggested by their support forum that code snippet can be added to the functions.php. The code snippet they suggested is as below. Can you please advise where should I add the code snippet to the Clean Education functions.php? Thank you.

    <?php
    /**
    * Removes link to a recurring event’s RSS feed from the <head>
    */
    function tribe_remove_recurring_feed() {
    if ( tribe_is_recurring_event() ) {
    remove_action( ‘wp_head’, ‘feed_links_extra’, 3 );
    }
    }
    add_action( ‘template_redirect’, ‘tribe_remove_recurring_feed’ );

    The Events Calendar support forums thread:
    https://theeventscalendar.com/support/forums/topic/spurious-urls-being-generated-creating-not-found-google-crawl-errors/

    #115919
    Mahesh
    Keymaster

    @biacna: For any customization, we recommend you to create a child theme first. Editing the core theme files do work but you’ll lose all the customization during updates. You can more details on creating child theme HERE. Then in your child theme’s functions.php add the above code snippet.

    Regards,
    Mahesh

    #115922
    Biacna
    Participant

    @Mahesh: Thank you very much. Can you advise exactly where should I insert the code. Below is the functions.php

    <?php
    /**
    * Functions and definitions
    *
    * Sets up the theme using core.php and provides some helper functions using custom functions.
    * Others are attached to action and
    * filter hooks in WordPress to change core functionality
    *
    * @package Catch Themes
    * @subpackage Clean Education
    * @since Clean Education 0.1
    */

    //define theme version
    if ( !defined( ‘CLEAN_EDUCATION_THEME_VERSION’ ) ) {
    $theme_data = wp_get_theme();

    define ( ‘CLEAN_EDUCATION_THEME_VERSION’, $theme_data->get( ‘Version’ ) );
    }

    /**
    * Implement the core functions
    */
    require trailingslashit( get_template_directory() ) . ‘inc/core.php’;

    #115935
    Mahesh
    Keymaster

    @biacna: Add it to the end of the file. I recommend you to use child theme.

    Regards,
    Mahesh

    #115970
    Biacna
    Participant

    @Mahesh: Thanks. I tried adding the snippet code at the end. But then my site got 500 internal server error. Can you advise what’s gone wrong?

    <?php
    /**
    * Functions and definitions
    *
    * Sets up the theme using core.php and provides some helper functions using custom functions.
    * Others are attached to action and
    * filter hooks in WordPress to change core functionality
    *
    * @package Catch Themes
    * @subpackage Clean Education
    * @since Clean Education 0.1
    */

    //define theme version
    if ( !defined( ‘CLEAN_EDUCATION_THEME_VERSION’ ) ) {
    $theme_data = wp_get_theme();

    define ( ‘CLEAN_EDUCATION_THEME_VERSION’, $theme_data->get( ‘Version’ ) );
    }

    /**
    * Implement the core functions
    */
    require trailingslashit( get_template_directory() ) . ‘inc/core.php’;

    /**
    * Removes link to a recurring event’s RSS feed from the <head>
    */
    function tribe_remove_recurring_feed() {
    if ( tribe_is_recurring_event() ) {
    remove_action( ‘wp_head’, ‘feed_links_extra’, 3 );
    }
    }
    add_action( ‘template_redirect’, ‘tribe_remove_recurring_feed’ );

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Add code snippet to functions.php’ is closed to new replies.