- This topic has 4 replies, 2 voices, and was last updated 6 years, 10 months ago by Biacna.
-
AuthorPosts
-
May 17, 2017 at 1:02 pm #115907BiacnaParticipant
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/May 18, 2017 at 12:12 am #115919MaheshKeymaster@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,
MaheshMay 18, 2017 at 12:35 am #115922BiacnaParticipant@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’;May 18, 2017 at 6:15 am #115935MaheshKeymaster@biacna: Add it to the end of the file. I recommend you to use child theme.
Regards,
MaheshMay 18, 2017 at 9:50 pm #115970BiacnaParticipant@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’ ); -
AuthorPosts
- The topic ‘Add code snippet to functions.php’ is closed to new replies.