WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [gallery] shortcode not displaying anything (10 posts)

  1. Harryson
    Member
    Posted 2 years ago #

    Hi,

    been searching for hours. I'm using custom theme and custom post type. I add my images to the gallery and include the shortcode [gallery] to my content. In editor, I can see the huge image gallery block..I save and in the front-end it displays nothing.

    So basically, as I understand, like always I did everything correct, but wordpress just magically isn't working, like it should.. I can see from the official doc http://codex.wordpress.org/Gallery_Shortcode that it should be that simple, and only thing that can even go wrong, is that you don't include any images to the gallery (not possible, as there are 5 images in the gallery.)

    So what is going on? Docs. don't say anything that you need to add some support function to your functions.php or does it mention, that this wont work in custom themes.

    All the reset of similar problems in this forum have been closed, with label still stating "Not resolved"..

  2. Harryson
    Member
    Posted 2 years ago #

    When I try to bypass this problem by creating my own shortcode to display the gallery. I use get_children() that doesn't return anything at all. So is there some trick, maybe when registering your custom post type related to post attachments?

  3. esmi
    Forum Moderator
    Posted 2 years ago #

    Have you tried:

    - deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - switching to the Twenty Eleven theme to rule out any theme-specific problems.

    - resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

  4. Harryson
    Member
    Posted 2 years ago #

    1. Cannot deactivate all plugins, as they are hooked to my site.
    2. Cannot switch to standard theme, as it has been deleted
    3. No inactive or "dead" plugins.

    How can this be affected by my custom theme? I didnt find any evidence, that the [gallery] is hooked to themeing in any way.

  5. Harryson
    Member
    Posted 2 years ago #

    Is there a function, that can retrieve all the posts attachments? So I could create my own shortcode...

  6. Harryson
    Member
    Posted 2 years ago #

    $arrImages = get_children('post_parent=' . $post->ID);
    print_r($arrImages);

    Does not return anything, what could be the problem?

  7. Harryson
    Member
    Posted 2 years ago #

    So basically, if I cannot retrieve the posts attachments then no surprise, that [gallery] doesn't work. Also, no surprise in the fact, how useless this forum really is on giving support :)

  8. Harryson
    Member
    Posted 2 years ago #

    Problem is much more deeper, then first though. It turns out, that get_children() or anything with child_of in it doesn't work.

    So for instance, if we have known page-id, that has child-pages aka. subpages, and that page-id is 410:

    $pages = get_pages('child_of=410');
    print_r($pages);

    Or any other possible querying method, DOESN'T WORK.

    This definitely isn't theme-related. So what is it? Possible, that wordpress core is buggy?

  9. keesiemeijer
    moderator
    Posted 2 years ago #

    So what is it? Possible, that wordpress core is buggy?

    It's also possible that one (or more) of your plugins or your theme conflicts with WordPress.

    try:
    - deactivating all plugins to see if this resolves the problem. If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - switching to the Twenty Eleven theme to rule out any theme-specific problems.

    - resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems.

  10. Harryson
    Member
    Posted 2 years ago #

    Ok, took plugin check little bit further..

    I figured out that the get_pages() was because of this plugin: http://wordpress.org/extend/plugins/exclude-pages/

    And the [gallery]'s source functions, that basically get children was bugged because:
    http://wordpress.org/extend/plugins/post-types-order/

    I wish the opposite of all the best to the authors of these plugins and hope, they will someday learn the essence of correct programming.

Topic Closed

This topic has been closed to new replies.

About this Topic