About this topic

  • Posted by Yes_Transport 1 year ago. There are 12 posts. The latest reply is from Yes_Transport.
  • This topic is resolved
  1. Hello Byron. Before bothering you I must say that I can't wait to see the new release that is integrated with google maps, one more amazing feature for PS!

    Okay, now the bad part :(

    I just started to use the name attribute to auto generate more than 1 gallery per post. Here perfect. Everything works just fine, but when out from the single.php,ex. category.php, seems that the shortcode [photosmash name="art vandelay"] creates a new gallery with the same name and associated with the same post instead of retrieving the one that already exists...

    Am I doing something wrong, or you as well have the same problem?

    Thanks for you time!

  2. Hi Yes,

    Thanks! I'm going to pilot the maps on this site, I think...it's mostly working except some crazy stuff in IE8.

    I tried to reproduce the catoegory issue, but can't seem to get my category pages to display the galleries. And they're not recreating the galleries then.

    Can you provide a link?

    Cheers,
    Byron

  3. When you think that you have everything figure out, IE will come and prove you wrong! Hopefully your issues with IE for this next release is not that bad :)

    I mixed up things. The behavior where it would create a new one even though it already existed one with the same name was on single.php. I allowed it to re-create (but it was necessary just one time, it would not go in a loop where every time that the single page is shown it would re-create another gallery over the last one re-created. -makes sense?-) and after that everything was fine on single.php.

    On the cagetory. Oddly sometimes re-creates and sometimes just calls the right gallery.

    Sorry, the code is now commented out. Since I don't want many duplicate galleries being created, I had to take off the galleries from showing on the categories... :(

    Hope I was more specific this time.

    thanks :)

  4. Sorry Yes,

    I'm still not quite getting it :-(

    BB

  5. Okay, lets try it again! :)

    I will make an exemple them.

    I had 5 galeries and was using the normal photosmash id=bla to get them on single.php and on the category.php:

    galerie id=1 name->cup, related post 1
    galerie id=2 name->fun, related post 2
    galerie id=3 name->car, related post 3
    galerie id=4 name->bus, related post 4
    galerie id=5 name->lamp, related post 5

    Them I changed the "id" for "name", so it would create new galleries automatic from now with the title name, something like that [photosmash name=$post_title].

    So now even thought the post title was the same as their names cup, fun, car, bus and lamp PS didn't get those galleries it created 5 more with the same name and different id's like that (that being called from single.php):

    gallery id=6 name->cup, related post 1
    gallery id=7 name->fun, related post 2
    gallery id=8 name->car, related post 3
    gallery id=9 name->bus, related post 4
    gallery id=10 name->lamp, related post 5

    And when I put the shortcode [photosmash name=$post_title] on category.php it would either not show any gallery or create even another one, instead of getting the one that already existed with that name and related to that post like:

    gallery id=11 name->cup, related post 1

    Okay I don't know anymore if I am making myself clear or being even more unclear...

    Did it help somehow?

  6. Ok.

    What is your code for putting the shortcodes into the category.php? Are you doing that within the loop? You should be able to paste it in...just use the backtick characters (see note above this box).

    BB

  7. Hello Byron.

    The code is within the loop. I use the apostrophe (') character, rather than the backtick character (`).

    code for both single and category files:

    $post_title = single_post_title('', false);

    echo do_shortcode("[photosmash name='$post_title' images='5' thumb_width='85' thumb_height='85' layout='ps_category']");

    Thanks for you attention :)

  8. Hi Yes,

    Just to eliminate something easy as a possible explanation, try changing

    $post_title = ... to

    $post_title = 'post_' . $post->ID;

    That way it will have very controlled post names. I'm wondering if somehow what it is looking for in the post name when it looks to see if the gallery exists isn't what is being posted.

    My limited test seemed to work with the code you had, but this might shed some light on the problem if it works.

    Cheers,
    Byron

  9. Hello Byron. One more time, thank you very much for your attention.

    Following your tip I did this change, not with ID, but still with title, and it worked perfectly!

    from: $post_title = single_post_title('', false);

    to: $post_title = $post->post_title;

    I don't know why but it worked. I been working at late night so the problem might have been my sleepy eyes :)

    Small suggestion:

    Add to the shortcode a parametrer that allows the shortcode to create a new gallery in case the gallery is not found.
    Something like that: [photosmash name='fun pic' create_gallery=true]

    This way we can control a little bit more the creation of galleries.

    After saying that I must say I have no words for how much I appreciate your help and your work with PS.

    Thank you :)

  10. Just for the record.

    Could be the reason for PS creating new galleries with the same name and related to the same post, when a gallery with that same name and related to the same post already existed, because the previous gallery was created before the "name" attribute was added to photosmash?

    Since I deleted all the "old" galleries that were created when PS didn't have the "name" attribute and created new ones, PS stopped creating galleries with a name and related to a post that already existed...

    It is right now the only explanation that crosses my mind...

    Cheers

  11. Hi Yes,

    Very welcome!

    I don't think the timing of the creation of the galleries was the issue. The database call just looks for the an exact match on the gallery name. It might have been that the "single_post_title('', false);" was not returning exactly the same title...maybe some spaces or other hidden characters or something...who knows???

    At any rate, glad it's working for you now.

    As for the suggestion about the "create_gallery=true", I'll think on that. The current default is to create the gallery if it doesn't exist, which I like. I might put in no_create_gallery=true instead so you can tell it not to create the gallery if you don't want it to. I'll have to think on it.

    Let me know what your thinking on that was.

    Cheers,
    Byron

  12. Hi Byron,

    I noticed that [photosamsh images="5"] and [photosamsh name="test" images="5"] will create a new gallery if a gallery related to that post is not found and if a gallery with that name related to that post is not found. At other hand [photosamsh id="5" images="5"] won't create a new gallery if not found.

    So I can think of a couple of situations that galleries would be create in a "bad way".

    1- If I use [photosamsh name="test" images="5"] on single.php, and [photosamsh images="5"] on category.php, whatever page is visited first will create the gallery. So if I go first to category and than to single it will create 2 galleries, one with no special name from the category code and the other with name "test" from the single.

    2- This is to prevent human error. If I have a gallery called "apple" created on single.php, and if by mistake I misspell "aple" when trying to get it on category, it will create another gallery that I don't want named "aple". If the no_create_gallery=true existed I wouldn't see any gallery being displayed on categories where real "apple" should be and would realize that something is wrong.

    Probably has others situations where it would be convenient as well to use no_create_gallery=true that I can think right now.

    Your way of thinking on no_create_gallery=true seems to be more logic to me as well. Considering that have people that already use the shortcode to auto create if not found and are happy with it, it would end up giving a lot of work for many people, not fare! :)

    By creating the exception rather than the rule, you add an option to the shortcode that is not necessary to who is already happy with it.

    Hope this helps you some how :)

    Cheers!

RSS feed for this topic