• Eugene Zayd

    (@eugenemsk)


    hi, i’ve made some changes to Events > Settings > Formatting > Events > Single event page format. Now, i want to see them in file – where can i find it? /wp-content/plugins/events-manager/templates/formats/single_event_format.php probably only base template, because there are no changes of mine in it. (There is no child theme. Copying & modifying single_event_format.php in /wp-content/plugin-templates/events-manager/formats/ has no effect also.)

Viewing 12 replies - 1 through 12 (of 12 total)
  • joneiseman

    (@joneiseman)

    I think, once you enable Advanced Mode in the Formatting tab, it will override the template files, I think if you want to use the template files you need to turn off advanced mode.

    When you change the formatting in the Formatting tab (after enabling Advanced mode) it definitely will not change any of the template files. You need to look in the formatting tab to see your changes.

    Thread Starter Eugene Zayd

    (@eugenemsk)

    So, in my case, if I want to repeat the path on this link, I have to create a code, enter it in the Code Snippets and insert a placeholder on the formatting tab, and not pay attention to the template files at all?

    (If so, then I made a mistake somewhere, because I have already done it, and I had no errors, no result….%-0)

    joneiseman

    (@joneiseman)

    So, you added #_EVENTURL in the Single Event formatting (in the Formatting tab) and you don’t see any change in the Single Event page? You should either see #_EVENTURL or else the actual URL. I don’t understand how it could not result in any change.

    Thread Starter Eugene Zayd

    (@eugenemsk)

    no, not #_EVENTURL, another placeholder, you said you could do any of my placeholders, and #_EVENTURL was just your example. Or not?

    Can I see somewhere in the system that this placeholder is defined and has a value?

    joneiseman

    (@joneiseman)

    The only way to see if the placeholder is defined is to use it in the single event page. If it is defined then it will return the value for the placeholder. If it’s not defined then it will just show the placeholder.

    Thread Starter Eugene Zayd

    (@eugenemsk)

    Here! And I inserted it and nothing, no value, no name.

    Some kind of magic.

    joneiseman

    (@joneiseman)

    Sounds like the code to create the new placeholder is returning an empty string. Maybe you could show the code here.

    Thread Starter Eugene Zayd

    (@eugenemsk)

    almost the same as case above, taking your code as example

    add_filter(’em_event_output_placeholder’,’my_em_output_placeholders’,1,3);
    function my_em_output_placeholders($replace, $EM_Event, $result){
    if( preg_match( ‘/#_EVENTMASTERNAME.*/’, $result ) ) {
    $url = get_field(‘eventmastername’, $EM_Event->post_id);
    if ( empty( $url ) ) {
    $replace = $url;
    }
    }
    return $replace;
    }

    joneiseman

    (@joneiseman)

    There was a mistake in my code (a missing exclamation mark) which you repeated in your code. Here’s a corrected version of your code:

    add_filter( 'em_event_output_placeholder', 'my_em_output_placeholders', 1, 3 );
    function my_em_output_placeholders( $replace, $EM_Event, $result ) {
        if( preg_match( '/#_EVENTMASTERNAME.*/', $result ) ) {
            $mastername = get_field( 'eventmastername', $EM_Event->post_id );
            $replace = ( ! empty( $mastername ) ) ? $mastername : "No Master Name";
        }
        return $replace;
    }

    It will replace #_EVENTMASTERNAME with the mastername if one was specified in the ACF ‘eventmastername’ field. Otherwise it will replace it with “No Master Name”.

    Thread Starter Eugene Zayd

    (@eugenemsk)

    it’s quite strange that the script started working when I changed “my_em_output_placeholders” to “my1_em_output_placeholders”….
    Now it shows “No Master Name”, regardless of whether the ACF field is filled in or not. That is, it sees the field, otherwise it would have output #_EVENTMASTERNAME as string, but…

    joneiseman

    (@joneiseman)

    No, I was wrong about that. I will never output #_EVENTMASTERNAME as a string.

    You mean you changed it to this?

    add_filter( 'em_event_output_placeholder', 'my_em_output_placeholders1', 1, 3 );
    function my_em_output_placeholders1( $replace, $EM_Event, $result ) {
        if( preg_match( '/#_EVENTMASTERNAME.*/', $result ) ) {
            $mastername = get_field( 'eventmastername', $EM_Event->post_id );
            $replace = ( ! empty( $mastername ) ) ? $mastername : "No Master Name";
        }
        return $replace;
    }

    Changing the function name makes no difference. If you see “No Master Name” it means that that there was no ACF field name ‘eventmastername’ on the event or that if it was specified it was not assigned a value.

    How are you assigning ACF values to the events?

    • This reply was modified 1 year ago by joneiseman.
    Thread Starter Eugene Zayd

    (@eugenemsk)

    First I changed exactly to your code. Nothing happened at all. Then I replaced to

    add_filter( 'em_event_output_placeholder', 'my1_em_output_placeholders', 1, 3 );
    function my1_em_output_placeholders( $replace, $EM_Event, $result ) {
        if( preg_match( '/#_EVENTMASTERNAME.*/', $result ) ) {
            $mastername = get_field( 'eventmastername', $EM_Event->post_id );
            $replace = ( ! empty( $mastername ) ) ? $mastername : "Нет ведущего или ведущий - организатор";
        }
        return $replace;
    } 

    it worked, but showed “No Master Name”.

    it sees the field, otherwise it would have output #_EVENTMASTERNAME as string, but

    here I meant that if a placeholder is inserted into the template that template cannot recognize, it will output its name as a string

    Ok, I understand your point of view about “not specified”, and I’m sure it is specified, because wp_fullcalendar sees this taxonomy, and displays it in the menu, and the menu selection correctly works out according to the taxonomy values assigned in the event. Maybe something is incorrectly configured. Thank you anyway, now I have to deal with ACF

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘changes in single page format’ is closed to new replies.