• Hello, on my website there are several listings from different users. These users can also create events – these are then visible collected on one page. Is there a possibility that the user also sees their created event displayed in their listing? Only their own event? Not all of them?!

    Which shortcode can be used for this?

Viewing 15 replies - 1 through 15 (of 15 total)
  • You can use the following shortcode:

    [events_list owner=me]
    Thread Starter wordpresser21

    (@wordpresser21)

    @joneiseman

    “Thanks! The shortcode works in principle, however, only I can see my ad. If someone else is on the website, they don’t see the event with the shortcode.

    I would like to solve the following:

    My website has 3000 listings (from different users), and I would like to use a shortcode to fixedly display the respective event under each listing (from the respective user who also published the listing and the event).”

    Do you mean that on each single event page you want to display a list of all the other events also owned by the user that owns the single event displayed on this single event page?

    Thread Starter wordpresser21

    (@wordpresser21)

    Currently, every user on the website can create an event – this is then displayed collectively on the “Event Page”. Many of the users who have created an event also have a listing on the website – and I would like their created event to also be visible in their own listing.

    For example: Association “ABC” creates an event. This event is visible on the overview with all other events. But Association ABC also has a listing on the website where it represents the association with its data – and in this listing, I would like to display the event of ABC using a shortcode.

    In your example is the ABC Association the Author of their listing page as well as the author of their event?

    Thread Starter wordpresser21

    (@wordpresser21)

    Yes, exactly – the ABC Association author is the same as the event creator.

    Thread Starter wordpresser21

    (@wordpresser21)

    Feel free to check out the website: https://laendleverein.at/veranstaltungen/ – here are all events from all users.

    and here: https://laendleverein.at/suche-auf-karte/ are, for example, all association listings – and in each listing, I would like its own created event to be visible.

    You could create your own shortcode to do this using the following code snippet:

    add_shortcode('em_events_list_by_author', 'my_event_list_by_author_shortcode');
    function my_event_list_by_author_shortcode($args, $format = '') {
    if (!function_exists('em_get_events_list_shortcode'))
    return "";
    $args = (array)$args;
    $args['owner'] = get_the_author_ID();
    return em_get_events_list_shortcode($args, $format);
    }

    Then you could use this shortcode: [em_events_list_by_author]

    You can use the Code Snippets plugin to add this code snippet.

    Edit to remove duplicate response

    • This reply was modified 2 weeks, 4 days ago by joneiseman.
    Thread Starter wordpresser21

    (@wordpresser21)

    Thank you very much – I tried it as you described (also with the plugin), however, no event is displayed via the shortcode? Do you have another idea?

    I put this shortcode on a page and it displayed all the events with the same owner as the page. No, I don’t have any other idea.

    Thread Starter wordpresser21

    (@wordpresser21)

    “I’m sorry for the question, but there isn’t a copy error in there, is there? Because actually, I can’t do anything wrong – I can’t find the mistake :-(“

    No, there’s no copy mistake. I suppose the author of the current page where you placed the shortcode does not have any events with the same author. Go in the the backend and look at the Pages list and check the see who is the author of the page where you placed the shortcode and then check that there is some event with the same author.

    You can use the following code snippet to create a shortcode that will show all the events which have the same author as the author of the current page:

    add_shortcode('display_the_shortcode', 'my_short_code_func');
    function my_short_code_func() {
    return '[events_list owner=' . get_the_author_ID() . "]";
    }

    Use the [display_the_shortcode] shortcode and when you display the page it will display something like:

    [events_list owner=42]

    Where 42 is the userid of the owner of the current page. Using the shortcode on this page will show all the events with the same owner as the current page.

    Thread Starter wordpresser21

    (@wordpresser21)

    Thank you very much for your detailed answers. For some listings, I am the author myself – and the events are still not displayed. I have tried everything multiple times. The error must lie somewhere else? I have a mistake somewhere that I currently cannot find.

    I would gladly give you access to my website so that you can look in the admin dashboard yourself?

    It’s against the forum rules to request or accept credentials for logging into a website.

    https://wordpress.org/support/guidelines/#we-reserve-the-right-to-manage-the-forums-to-the-best-of-our-ability

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.