WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: All In One Event Calendar] Single Event shows incorrectly custom theme (4 posts)

  1. netwrkgod
    Member
    Posted 2 years ago #

    Hello. I'm a WP newb and need some help. I've been struggling for a long time fixing this problem.

    When a user clicks on an event that's listed in the calendar, the event is then displayed three times on the single event page - once in the side bar, once in the main page box, and once in the footer. I've copied the single.php file to single-ai1ec_event.php and tried to modify that to get it work, but I can't get it. This is a custom theme.

    Ai1ec ver. 1.2
    Wp ver 3.2.1

    Here'e an example of the problem:
    http://stmmagdalen.org/ai1ec_event/sunday-mass-2/?instance_id=24202

    Any suggestions?

  2. netwrkgod
    Member
    Posted 2 years ago #

    Here is the part of the single event page that displays the left side bar:

    <?php 
    
    $pageInfo = get_page_by_title("Left-Side-Bar Ads");
    $page_data = get_page( $pageInfo->ID );
    $content = apply_filters("the_content", $page_data->post_content);
    
    echo ($content); // Output Content  
    
    ?>

    The footer part looks the same:

    <?php 
    
    $pageInfo = get_page_by_title("Footer");
    $page_data = get_page( $pageInfo->ID );
    $content = apply_filters("the_content", $page_data->post_content);
    
    echo ($content); // Output Content
    ?>

    Is there something I can put in the apply_filters part or maybe wrap the code somehow to eliminate the ai1ec part that's being included?

  3. netwrkgod
    Member
    Posted 2 years ago #

    Something like this (I'm not a developer, so I know this probably isn't correct - it's just an illustration):

    <?php
    if ( get_post_type() != 'ai1ec_event')
    {
       $pageInfo = get_page_by_title("Footer");
        $page_data = get_page( $pageInfo->ID );
       $content = apply_filters("the_content", $page_data->post_content);
    }
    echo ($content); // Output Content
    ?>
  4. netwrkgod
    Member
    Posted 2 years ago #

    Here's the hack, if anybody is interested:

    <?php
        					  $pageInfo = get_page_by_title("Footer");
        					  $page_data = get_page( $pageInfo->ID );
                  	$content = apply_filters("the_content", $page_data->post_content);
                  	//$title = $page_data->post_title; // Get title
    
                  	// Remove event code if present
                  	if(strpos($content, "<a name=\"ai1ec-event\">") !== false) {
                  	  $pos1 = strpos($content, "<a name=\"ai1ec-event\">");
                  	  $pos2 = strpos($content, "</table>", $pos1);
    
                  	  if($pos2 !== false) {
                  	    $content = substr($content, 0, $pos1) . substr($content, $pos2 + 8);
                  	  }
                  	}
    
                  	$pos1 = strpos($content, "<div class=\"ai1ec-event-footer\">");
    
                	  if($pos1 !== false) {
                	    $pos2 = strpos($content, "</div>", $pos1);
    
                	    if($pos2 !== false) {
                	      $content = substr($content, 0, $pos1) . substr($content, $pos2 + 6);
                	    }
                	  }
    
                  	echo ($content); // Output Content
        					?>

Topic Closed

This topic has been closed to new replies.

About this Topic