Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    try under Events > Settings > Formatting > Events

    Thread Starter keneso

    (@keneso)

    Thank you.
    I did so, but it doesn’t seem to work, unless I missed something.

    Can you share a link to the page?

    Thread Starter keneso

    (@keneso)

    Sorry for the delay.

    Here is the link, in red the content i’d like to have before the details:

    I had modified the event formatting like the following code, and would like to have the extra content to be in the extra-content div.

    <div class="row">
    	<div class="col grid_12_of_12 extra-content">
    	</div>
    </div>
    
    <div class="row">
    	<div class="col grid_8_of_12">
    		<p>
    		<strong>Date/Time</strong><br/>
    		Date(s) - #_EVENTDATES<br /><i>#_EVENTTIMES</i>
    		</p>
    		{has_location}
    		<p>
    			<strong>Location</strong><br/>
    			#_LOCATIONLINK
    		</p>
    		{/has_location}
    		<p>
    			<strong>Category(ies)</strong>
    			#_CATEGORIES
    		</p>
    		<br style="clear:both" />
    		#_EVENTNOTES
    		{has_bookings}
    		<h3>Bookings</h3>
    		#_BOOKINGFORM
    		{/has_bookings}
    	</div>
    	<div class="col grid_4_of_12">
    		#_LOCATIONMAP
    	</div>
    </div>
    Plugin Support angelo_nwl

    (@angelo_nwl)

    is that using Events > Settings > Formatting > Events > Default single event format ? Or can you try to add the additional content just below this line <div class="col grid_12_of_12 extra-content"> ?

    Thread Starter keneso

    (@keneso)

    Thanks for the reply.

    Yes that code is put in
    Events > Settings > Formatting > Events > Default single event format

    I know I can add that info in the extra-content div, problem is that the content is not the same for all events, and each event has its own extra-content.

    The example in the given link has been added by just putting it in the wordpress editor, where you usuallly put the content of your page/post, and obviously events-manager is set up to push that content after its (events-manager) own content.

    I’d like to change that to first display the wordpress editor content, and only after the events-manager content.

    Hiya,

    In order to do that you should use the the_content filter in some custom code to add the content before the EM content.

    Thanks

    Thread Starter keneso

    (@keneso)

    Thank you.

    Yes, problem is I don’t know how, where, which.

    This should help:
    https://codex.www.ads-software.com/Plugin_API/Filter_Reference/the_content

    The Post Icon example is somewhat similar to what you want to do.

    Thread Starter keneso

    (@keneso)

    Thank you.

    I’ve read it, but still can’t figure out where, and how to change it.
    I found the_content in em-events.php, and in classes/em-event-post.php but due to my lack of knowledge I just can’t figure it out.
    Will you please kindly give me the snip, and where to put it?

    Try something like this in the functions.php file of your theme:

    add_filter( 'the_content', 'my_the_content_filter', 20 );
    function my_the_content_filter( $content ) {
    
    if ( get_post_type() == 'event') {
    $before_content = 'your stuff here';
    
    $after_content = 'your 2 stuff here'; 
    
    $content = $before_content . $content . $after_content;
    }
    
        return $content;
    }

    You’d need to fill the $before_content and $after_content variables with your content.

    Thread Starter keneso

    (@keneso)

    Thank you for your patience.

    Unfortunatelly I don’t seem to get it work:

    I used your suggestion as it is, and also tried
    $before_content = the_content();
    $before_content = the_post();

    In no case I could get the content I put in the editor to show where I need it.

    I’m not sure what you’re trying to do with this

    $before_content = the_content();
    $before_content = the_post();

    but neither the_content() or the_post() are designed to be used within a function.

    I tested the snippet using the default WordPress theme, so I’m not sure why it’s not working in your theme.

    Just to clarify, this snippet should output like this on the page:

    your stuff here
    [events manager output]
    your 2 stuff here

    It’ll only work on the single event pages.

    Thread Starter keneso

    (@keneso)

    Thank you.

    Indeed your suggestion was very clear, but since it did not work with my theme (quark), in my ignorance I tried different stuff among which what I posted.

    However, even if I get it to work (I’ll try with default WP theme, my intent was to add custom content to each single event, whereas if I am understanding correctly your suggestion it adds the same content for all events.

    That’s true, it would. But if you replaced the ‘your stuff here’ parts of the function with, for example, a custom post field you could add unique content to each event.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘add content before event information’ is closed to new replies.