• Ich bin kurz vor der Verzweiflung, weil ich absolut den Fehler nicht sehe. Was mache ich hier falsch?

    Ich migriere Custom-Content-Shortcode-Befehle in Loops & Logic und habe hier zwei Befehlss?tze. Der für CCS funktioniert:

    
    [loop type=jobs]
    [field url]
    [/loop]
    

    The code for L&L looks like this, but there is no output:

    
    <Loop type=jobs>
      <Field url />
    </Loop>
    

    I’m using a plugin called “Jobs for WordPress” which is generating an own Custom Post Type (“jobs”).

Viewing 15 replies - 1 through 15 (of 17 total)
  • Thread Starter Besim Karadeniz

    (@besimk)

    The first sentences in english: ??

    I am on the verge of despair because I absolutely do not see the error. What am I doing wrong here?

    I am migrating custom content shortcode commands into Loops & Logic and I have two sets of commands here. The one for CCS works:

    Plugin Author Eliot Akira

    (@miyarakira)

    Hmm, that is mysterious. The CCS and L&L code look the same, and should be working the same too.

    If the CCS loop is working, it means the post type’s name “jobs” is correct.

    I wonder, maybe the post type uses some special post status other than normal ones like publish/draft? You could try Loop type=jobs status=all and see if anything shows.

    It could be that the post type is created with a specific setting passed to register_post_type, that somehow makes it behave differently, where L&L cannot find it. For example, maybe “publicly_queryable” is set to false.

    To try to debug it, you can try this code snippet in your theme’s functions.php.

    add_action( 'wp', function () {
    
      $types = get_post_types([
        'name' => 'jobs'
      ], 'objects');
    
      tangible()->see( $types );
    
    }, 0, 99 );
    

    (Edit: This snippet requires L&L to be active.)

    That should display the “jobs” post type and its settings – in particular, I’m curious if it has “public” and “publicly_queryable” both set to TRUE.

    • This reply was modified 2 years, 2 months ago by Eliot Akira.
    Thread Starter Besim Karadeniz

    (@besimk)

    Both switches are TRUE. Here is the complete array for the custom post type:

    Array
    (
        [jobs] => Array
            (
                [__instance__] => Class WP_Post_Type in wp-includes/class-wp-post-type.php on line 17
                [name] => jobs
                [label] => Stelleninserate
                [labels] => Array
                    (
                        [__instance__] => Class stdClass in  on line 
                        [name] => Stelleninserate
                        [singular_name] => Stelleninserat
                        [add_new] => Neues Inserat erfassen
                        [add_new_item] => Neues Inserat erfassen
                        [edit_item] => Aktualisieren
                        [new_item] => Neues Inserat
                        [view_item] => Anschauen
                        [view_items] => Beitr?ge ansehen
                        [search_items] => Beitr?ge durchsuchen
                        [not_found] => Keine Beitr?ge gefunden.
                        [not_found_in_trash] => Keine Beitr?ge im Papierkorb gefunden.
                        [parent_item_colon] => NULL
                        [all_items] => Alle Inserate
                        [archives] => Alle Inserate
                        [attributes] => Beitrags-Attribute
                        [insert_into_item] => In den Beitrag einfügen
                        [uploaded_to_this_item] => Zu diesem Beitrag hochgeladen
                        [featured_image] => Beitragsbild
                        [set_featured_image] => Beitragsbild festlegen
                        [remove_featured_image] => Beitragsbild entfernen
                        [use_featured_image] => Als Beitragsbild nutzen
                        [filter_items_list] => Beitragsliste filtern
                        [filter_by_date] => Nach Datum filtern
                        [items_list_navigation] => Navigation der Beitragsliste
                        [items_list] => Beitragsliste
                        [item_published] => Beitrag ver?ffentlicht.
                        [item_published_privately] => Beitrag privat ver?ffentlicht.
                        [item_reverted_to_draft] => Beitrag auf Entwurf zurückgesetzt.
                        [item_scheduled] => Beitrag geplant.
                        [item_updated] => Beitrag aktualisiert.
                        [item_link] => Beitragslink
                        [item_link_description] => Ein Link zu einem Beitrag.
                        [menu_name] => Stelleninserate
                        [name_admin_bar] => Stelleninserat
                    )
    
                [description] => 
                [public] => TRUE
                [hierarchical] => FALSE
                [exclude_from_search] => FALSE
                [publicly_queryable] => TRUE
                [show_ui] => TRUE
                [show_in_menu] => TRUE
                [show_in_nav_menus] => FALSE
                [show_in_admin_bar] => TRUE
                [menu_position] => 21
                [menu_icon] => dashicons-businessman
                [capability_type] => post
                [map_meta_cap] => TRUE
                [register_meta_box_cb] => NULL
                [taxonomies] => Array
                    (
                    )
    
                [has_archive] => FALSE
                [query_var] => jobs
                [can_export] => TRUE
                [delete_with_user] => NULL
                [template] => Array
                    (
                    )
    
                [template_lock] => FALSE
                [_builtin] => FALSE
                [_edit_link] => post.php?post=%d
                [cap] => Array
                    (
                        [__instance__] => Class stdClass in  on line 
                        [edit_post] => edit_post
                        [read_post] => read_post
                        [delete_post] => delete_post
                        [edit_posts] => edit_posts
                        [edit_others_posts] => edit_others_posts
                        [delete_posts] => delete_posts
                        [publish_posts] => publish_posts
                        [read_private_posts] => read_private_posts
                        [read] => read
                        [delete_private_posts] => delete_private_posts
                        [delete_published_posts] => delete_published_posts
                        [delete_others_posts] => delete_others_posts
                        [edit_private_posts] => edit_private_posts
                        [edit_published_posts] => edit_published_posts
                        [create_posts] => edit_posts
                    )
    
                [rewrite] => Array
                    (
                        [slug] => job
                        [with_front] => FALSE
                        [pages] => TRUE
                        [feeds] => FALSE
                        [ep_mask] => 1
                    )
    
                [show_in_rest] => TRUE
                [rest_base] => FALSE
                [rest_namespace] => wp/v2
                [rest_controller_class] => WP_REST_Posts_Controller
                [rest_controller] => NULL
            )
    
    )
    Plugin Author Eliot Akira

    (@miyarakira)

    Thanks for posting the result – all post type settings seem to be normal, including user capability.

    Just in case – is your L&L code snippet in the post content like the shortcode, or is it in the Template post type?

    Unlike shortcodes, L&L tags only work in the latter context – so you have to create a template, then load it into the post content with a [template] shortcode (as described in this article, Displaying an L&L template).

    • This reply was modified 2 years, 2 months ago by Eliot Akira.
    Thread Starter Besim Karadeniz

    (@besimk)

    Unfortunately the same behaviour. I tested this with including the code snipped directly in a page and with an separate template and calling it via shortcode and via the gutenberg-block.

    Plugin Author Eliot Akira

    (@miyarakira)

    OK, so it sounds like the L&L code snippet is actually running – it should work anywhere that the template editor is.

    Another angle we can try, to check if the post status is normal. Could you try putting the following in functions.php?

    add_action('wp', function() {
    
      $posts = get_posts([
        'post_type' => 'jobs',
        'numberposts' => 1
      ]);
    
      tangible()->see( $posts );
    
    }, 0, 99);
    

    That should display a single post from the “jobs” post type. If it’s empty, it probably means something special is necessary to get the posts. If it shows a post, we can check its property called post_status to see if it’s “publish” or something custom.

    Thread Starter Besim Karadeniz

    (@besimk)

    No change in behaviour, unfortunately

    Here is the output of the array:

    Array
    (
        [0] => Array
            (
                [__instance__] => Class WP_Post in wp-includes/class-wp-post.php on line 21
                [ID] => 285
                [post_author] => 1
                [post_date] => 2022-06-30 13:15:14
                [post_date_gmt] => 2022-06-30 11:15:14
                [post_content] => 
                [post_title] => Rodensteiner, Küchenhilfe
                [post_excerpt] => 
                [post_status] => publish
                [comment_status] => closed
                [ping_status] => closed
                [post_password] => 
                [post_name] => rodensteiner-kuechenhilfe
                [to_ping] => 
                [pinged] => 
                [post_modified] => 2022-09-13 20:50:00
                [post_modified_gmt] => 2022-09-13 18:50:00
                [post_content_filtered] => 
                [post_parent] => 2
                [guid] => https://www.pf-bits.de/jobs/?post_type=jobs&p=285
                [menu_order] => 0
                [post_type] => jobs
                [post_mime_type] => 
                [comment_count] => 0
                [filter] => raw
            )
    
    )
    Thread Starter Besim Karadeniz

    (@besimk)

    Hi Ben,
    Let me prepare a test environment for you, I will then inform you about your ticket system including access data.

    Thread Starter Besim Karadeniz

    (@besimk)

    Unfortunately, even after months, I still have no idea why the loop of certain Custom Post Types is not working for me. The problem described here still exists, no matter how I form the loop. However, I have other Custom Post Types in this installation with which the loop works.

    Can I “bother” you with this again? I will gladly provide access to the site in question again.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Moderator note: @bentangible I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us escalating this to the plugins team.

    It’s never necessary to do that. Here’s why.

    There are many ways to get information you need and accessing the user’s site is not one of them. That’s going too far.

    • Ask for a link to the https://pastebin.com/ or https://gist.github.com log of the user’s web server error log.
    • Ask the user to create and post a link to their phpinfo(); output.
    • Ask the user to install the Health Check plugin and get the data that way.
    • Walk the user through enabling WP_DEBUG and how to log that output to a file and how to share that file.
    • Walk the user through basic troubleshooting steps such and disabling all other plugins, clear their cache and cookies and try again.
    • Ask the user for the step-by-step on how they can reproduce the problem.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @miyarakira I’ve deleted your offer to login to your user’s site. I’m am 100% sure you mean well but please never ask for credentials on these forums.

    Now for the why: The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    If something was to go wrong, then you the author may well legally become liable for damages, which they would not normally have been as their software is provided without warranty.

    Please be aware that repeatedly asking for credentials will result in us escalating this to the plugins team.

    It’s never necessary to do that. Here’s why.

    There are many ways to get information you need and accessing the user’s site is not one of them. That’s going too far.

    • Ask for a link to the https://pastebin.com/ or https://gist.github.com log of the user’s web server error log.
    • Ask the user to create and post a link to their phpinfo(); output.
    • Ask the user to install the Health Check plugin and get the data that way.
    • Walk the user through enabling WP_DEBUG and how to log that output to a file and how to share that file.
    • Walk the user through basic troubleshooting steps such and disabling all other plugins, clear their cache and cookies and try again.
    • Ask the user for the step-by-step on how they can reproduce the problem.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.

    Thread Starter Besim Karadeniz

    (@besimk)

    @sterndata Never mind, I already know Ben from previous conversations and we had exchanged credentials OUTSIDE the forum before.

    @bentangible I’ll contact you shortly.

    Regards,
    Besim

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    ?@besimk Please don’t offer to send or post logon credentials on these forums: https://www.ads-software.com/support/guidelines#the-bad-stuff

    It is not OK to offer, enter, or send site credentials on these forums. Thanks for your cooperation.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    @besimk Note that this is going to get these plugin devs in trouble for violating forum rules.

    Hi @sterndata, thanks for the information, I wasn’t aware of that policy/recommendation and I’ll do my best to adhere to that moving forward. Thanks for your efforts in keeping this forum safe for everyone!

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Looping of Custom Post Type not working’ is closed to new replies.