Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi there, idtsevak. We should be able to help you out here – your goal is just to limit the dropdown to 4 years, and nothing beyond that? Let me know if I’m wrong there. Otherwise, I’ve asked Jonah from our team to take a look here and try to point you in the right direction. Stay tuned and thanks for your use of the plugin so far.

    Hi idtsevak,

    You can use the following code in your themes functions.php file to adjust how many years show in the drop down:

    /*-----------------------------------------------------------------------------------*/
    /* filter the number of years to go back
    /*-----------------------------------------------------------------------------------*/
    add_filter('tribe_years_to_go_back', 'my_tribe_years_to_go_back');
    function my_tribe_years_to_go_back() {
    	return 10; //returns 2 years back from the current year
    }
    
    /*-----------------------------------------------------------------------------------*/
    /* filter the number of years to go forwards
    /*-----------------------------------------------------------------------------------*/
    add_filter('tribe_years_to_go_forward', 'tribe_years_to_go_forward');
    function tribe_years_to_go_forward() {
    	return 3; //returns 3 years forward from the current year
    }

    I hope that helps but let me know if you need anything else!

    Cheers,
    Jonah

    Thread Starter idtsevak

    (@idtsevak)

    Hi Jonah,
    i have used your code in functions.php, but its not working.
    And after putting the code in function.php, i found an error that the code is coming on the top the website and my wordpress dashboard.

    i am using DailyJournal elegant theme…

    Hi idtsevak,

    Can you please post your full functions.php so I can see what’s going on.

    Thanks,
    Jonah

    Thread Starter idtsevak

    (@idtsevak)

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin ]

    <?php
    add_action( 'after_setup_theme', 'et_setup_theme' );
    if ( ! function_exists( 'et_setup_theme' ) ){
    	function et_setup_theme(){
    		global $themename, $shortname;
    		$themename = "DailyJournal";
    		$shortname = "dailyjournal";
    
    		require_once(TEMPLATEPATH . '/epanel/custom_functions.php'); 
    
    		require_once(TEMPLATEPATH . '/includes/functions/comments.php'); 
    
    		require_once(TEMPLATEPATH . '/includes/functions/sidebars.php'); 
    
    		load_theme_textdomain('DailyJournal',get_template_directory().'/lang');
    
    		require_once(TEMPLATEPATH . '/epanel/options_dailyjournal.php');
    
    		require_once(TEMPLATEPATH . '/epanel/core_functions.php'); 
    
    		require_once(TEMPLATEPATH . '/epanel/post_thumbnails_dailyjournal.php');
    
    		include(TEMPLATEPATH . '/includes/widgets.php');
    
    		add_theme_support( 'automatic-feed-links' );
    	}
    }
    
    function register_main_menus() {
    	register_nav_menus(
    		array(
    			'primary-menu' => __( 'Primary Menu', 'DailyJournal' )
    		)
    	);
    }
    if (function_exists('register_nav_menus')) add_action( 'init', 'register_main_menus' );
    
    // add Home link to the custom menu WP-Admin page
    function et_add_home_link( $args ) {
    	$args['show_home'] = true;
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'et_add_home_link' );
    
    add_action( 'wp_enqueue_scripts', 'et_load_dailyjournal_scripts' );
    function et_load_dailyjournal_scripts(){
    	if ( !is_admin() ){
    		$template_dir = get_template_directory_uri();
    
    		wp_enqueue_script('superfish', $template_dir . '/js/superfish.js', array('jquery'), '1.0', true);
    		wp_enqueue_script('fitvids', $template_dir . '/js/jquery.fitvids.js', array('jquery'), '1.0', true);
    		wp_enqueue_script('custom_script', $template_dir . '/js/custom.js', array('jquery'), '1.0', true);
    	}
    	if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' );
    }
    
    add_action( 'wp_head', 'et_add_viewport_meta' );
    function et_add_viewport_meta(){
    	echo '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />';
    }
    
    if ( ! function_exists( 'et_list_pings' ) ){
    	function et_list_pings($comment, $args, $depth) {
    		$GLOBALS['comment'] = $comment; ?>
    		<li id="comment-<?php comment_ID(); ?>"><?php comment_author_link(); ?> - <?php comment_excerpt(); ?>
    	<?php }
    }
    
    add_action( 'admin_enqueue_scripts', 'et_portfolio_fullwidth_delete' );
    function et_portfolio_fullwidth_delete( $hook_suffix ) {
    	if ( in_array($hook_suffix, array('post.php','post-new.php')) ) {
    		wp_enqueue_script('et-ptemplates-fwdelete', get_bloginfo('template_directory') . '/js/delete_fwidth.js', array('jquery'), '1.1', false);
    	}
    }
    
    add_action('et_head_meta','et_add_google_fonts');
    function et_add_google_fonts(){
    	echo "<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css' />";
    } ?>

    Hi idtsevak,

    So, make sure you paste the snippet I posted before the closing ?> PHP bracket or else start a new one…

    – Jonah

    Thread Starter idtsevak

    (@idtsevak)

    Great!!!
    Thank you very much its working…

    One more help required:
    In calender template there is option to add HTML before calendar. So when i am adding any html snippet in this, it comes in all places like event list and in all single event info.

    But i want to show that html snippet only on my “Calendar of Events” pages, not on other pages..

    And same Add HTML after calendar (footer)

    Please help

    Hi idtsevak,

    Glad that worked. To get the before and after HTML online on the calendar page, you’ll want to make a copy of /wp-content/plugins/the-events-calendar/views/gridview.php and place in an ‘events’ folder in your theme and then add your custom HTML directly there. Also, you’ll either want to remove the before & after HTML template tags from the template or remove it from the options.

    I hope that helps!

    – Jonah

    Thread Starter idtsevak

    (@idtsevak)

    Great…………….
    Its Working.
    Thank you so much jonah….
    You have solved every thing…..

    Glad to hear idtsevak, let me know if you need anything else.

    – Jonah

    Thread Starter idtsevak

    (@idtsevak)

    Hi Jonah
    Thank you for your continuous support..
    I need your help again please check my new conversation…

    http://wordpress.org/support/topic/plugin-the-events-calendar-replace-posting-date-with-event-date-in-rss-feed?replies=1

    Hi there idtsevak. I see that Jonah has responded in the thread you linked to, so let’s keep the discussion going over there. Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘[Plugin: The Events Calendar] Only upcoming 4 years in drop down in calender view’ is closed to new replies.