Part 25 - WordPress Theme Development - Gallery Post Format - PART 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ธ.ค. 2024

ความคิดเห็น • 77

  • @CyberIllusions
    @CyberIllusions 8 ปีที่แล้ว +1

    Alex, I'm really amazed by your profound WordPess knowledge! THX for sharing it!!

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว +1

      +CyberIllusions Oh wow, thank you so much, and thank for keep following my tutorials, you've been a loyal follower :D

  • @aladar-minigoonvendreener5660
    @aladar-minigoonvendreener5660 2 ปีที่แล้ว

    thnx for this lesson, I really like and enjoy this playlist

  • @parleycp
    @parleycp 8 ปีที่แล้ว +1

    Hey Alex , this is probably the best post format tutorial.....till now :))
    I have to add one thing. The Glyphicon fonts didnt work here because ... i dont know , but sumthing related to bootstrap and fixed by reloaded the bootstrap in enqueue.php using CDN

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว +1

      +Cristian Pirloaga Hi, thanks for following.
      Probably you had some issue with your enqueue script, especially if you changed the location of the font folder of Bootstrap.
      I'm glad you solved it anyway.

  • @googletibet
    @googletibet 8 ปีที่แล้ว +1

    best tutorial.. Sir, please keep it on!

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว +1

      Thank you so much, I'll never stop. Next tutorial in a couple of days 😉

  • @Ismail-sir
    @Ismail-sir 9 หลายเดือนก่อน

    Amazing, super amazing 🤩

  • @markwaters5964
    @markwaters5964 8 ปีที่แล้ว +1

    Thanks for this. So helpful!

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว

      +Mark Waters Happy to hear that :D

  • @kevinmackey3166
    @kevinmackey3166 5 ปีที่แล้ว +3

    I have not been able to get the *_sunset_get_attachment()_* function working. I think something has been changed about the way WordPress attaches images to posts, because every time I check the *_post_parent_* value for any of the images in a post, it returns 0

    • @osamashah202
      @osamashah202 5 ปีที่แล้ว

      Yes something changed... we have the_post_thumbnil()...

  • @denicho2397
    @denicho2397 8 ปีที่แล้ว +1

    Hello, thank you very much for all of your efforts you put into making these videos.
    These are very helpful!I'm still in your Wordpress 101 tutorial, but if I might ask.. Can I jump into this episodes after finishing the Wordpress 101?
    Again, thanks!

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว +1

      +Deni Cho Hi, thank you so much for following.
      After finishing the WP101, you can definitely start this new series, but of course always start from the beginning and don't skip any episode.
      The WP101 is more an overview of various functions and options for beginners.
      This current series is more intermediate, and the building of a theme is more methodic, with the final goal of creating a fully functional theme ready to be sold or upload to the WordPress theme repository.
      Happy Coding!

    • @denicho2397
      @denicho2397 8 ปีที่แล้ว +1

      +Alessandro Castellani What a quick reply! Luckily, I am a kind of person who never skips any tutorial. The way you teach is so good that makes it hard to even skip a minute.
      Alright, back to learning again.
      Good day to you!

  • @yeinygarzon9909
    @yeinygarzon9909 8 ปีที่แล้ว +1

    hi @Alessandro_Castellani, first THANK U 4 take your time and share your knowledge and experience through your videos!
    Second, I want to ask u: I'm trying to do the slide carousel but in the header (instead of the banner) with the attachment function. How could I get the tag *header_image()* works with the function?
    Thank u again ;)

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว

      Hi, thank you so much for watching my videos.
      The approach I'd suggest you is to create a Custom Admin Section and use the Media Uploader to upload as many images as the user wants.
      Basically create something like the Custom Headers Theme Support Option, but with multiple uploads, and then create the slider by looping through those images.
      I hope that helps,
      Happy Coding!

  • @orbox
    @orbox 8 ปีที่แล้ว +1

    Thanks a lot for this tutorial. It's been very helpful and I'd have no idea how to do any of these things without your direction.
    One thing I've noticed though is that the upload profile picture in the theme sidebar settings isn't working. There aren't any issues with the JS as far as I know but when I click the "upload profile picture" button nothing happens.

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว

      +Gabe Hi, hooking the media uploader is always tricky and easy to break. Try to compare my source code from the GitHub repo to see if it matches yours.
      Happy Coding!

  • @subu123ful
    @subu123ful 8 ปีที่แล้ว +1

    Once again a nice tutorials. You have made wordpress easy for me. Now i m looking for part 2 of gallery post format but most importantly front end sidebar section and contact form section. I used a plugin (gravity form custom posttype) to collect input value from front-end and save those value in back-end as custom post. I m exited what u will do??
    Thank you for your time... Please keep it on

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว

      +Subhasish Manna Thank you for following with such enthusiasm.
      I will definitely code everything you listed, I want to finish the blog loop before, and create the Ajax loading of the posts, without the standard pagination.
      After that, I will code the front end of the Contact Form and the dynamic sidebar.

    • @subu123ful
      @subu123ful 8 ปีที่แล้ว +1

      +Alessandro Castellani and that ajax loading takes user experience in another level. NOW this is called premium theme and u titled it damn right.

  • @melvy7214
    @melvy7214 8 ปีที่แล้ว +1

    Thank you for this tutorial.
    I'm still in part 14 though, just checking this one haha

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว

      +Melvy Don't skip ahead :P
      Thanks for following

  • @piotao
    @piotao 7 ปีที่แล้ว +1

    How to do this without bootstrap? I started building the site and I resigned with bootstrap, using my own reset css (based on ResetCSS). Is there any simple and easy way to implement a very basic, simple slider, without the whole bloat of bootstrap?

    • @alecaddd
      @alecaddd  7 ปีที่แล้ว

      +Piotr Arłukowicz sure, there are plenty of free source code for sliders or carousel.
      OwlCarousel is my favourite.
      SlickSlider is another good one.
      I also have a really basic script in my GitHub repo called aSlider.
      Probably the tutorial will be a bit hard to follow with another slider, but concepts and main steps should be identical

  • @georgecaplan11
    @georgecaplan11 3 ปีที่แล้ว

    If you are using bootstrap 4 you need to add this class to make the "container-fluid" stretch the header to the width of the page: "px-0". Also 'item' class should be "carousel-item'. However, I have hit a roadblock in that the carousel will not function. When you inspect the code the images are there and the active class is applied to the first image but it wont apply the active class to the next one etc. I have re-downloaded your code from git hub and also have removed and reinstalled bootstrap js but nothing works. Im wondering if this is some sort of incompatibility between wordpress and bootstrap 4 with respect to the carousel. I have even installed the jquery migrate helper plugin but nothing works. I am learning a lot from your tutorials and am very grateful for the work you have put in to make them all but it can be frustrating when you want something to work and despite googling solutions for hours nothing works. I am wondering if there is an issue with relying upon the function wp_get_attachment_url().

  • @seandoherty5340
    @seandoherty5340 6 ปีที่แล้ว +1

    Hi Alessandro. Great lecture series - I'm learning a lot from you, thanks! I'm having an issue with retrieving images that have been inserted into the post body by the user. I am being returned an empty array if I var_dump($output) just before the return in the sunset_get_attachment() function. This did work before you refactored the function but hasn't been tested since. Obviously, without this working then the galley post type is not going to work. I've copied your function and the content-gallery direct from github and still no joy. Any suggestions why the function isn't picking up the image content from the posts?

    • @alecaddd
      @alecaddd  6 ปีที่แล้ว

      Hi, thank you so much for watching my videos. This is a known issue of WordPress related to the attachments. If the image was uploaded previously, it remains "attached" to the original location, so even if you remove those pictures from the post or add others, are not considered as post's attachment.
      You could overcome this issue by getting the content of the post and extracting all the images from there with a regex method. Cheers

    • @suresmaharjan9809
      @suresmaharjan9809 6 ปีที่แล้ว

      @@alecaddd regex method but how?

    • @nobir98
      @nobir98 5 ปีที่แล้ว

      @@alecaddd brother This issue is bugging me really ... how to fix this .. regex thats too complex for me :") plz help
      thanks in advance :D

    • @georgecaplan11
      @georgecaplan11 3 ปีที่แล้ว

      Alex gives an example of regex method in part 29.

  • @JuanDZulliger
    @JuanDZulliger 7 ปีที่แล้ว +1

    Hey aless! i love ur videos, iv been watch em a lot lately and they are great! ...i have a problem tho XD . I re-watched and re-checked every page that you edit in the part 25 (and even hard copy-paste ur code from github) but the carrousel just doesnt work. In the inspector i can see that it applies the "active" item to the 1º, but i never moves nor changes the "active" to the next one. What part could be wrong?, what do i have to check in your opinion?. Thank you, Juan Diego Zulliger

    • @alecaddd
      @alecaddd  7 ปีที่แล้ว

      Hi, thanks for watching.
      Are you sure Bootstrap is properly enqueued? Try to check if any other javascript related feature of bootstrap works.
      Any issue in your console?

    • @JuanDZulliger
      @JuanDZulliger 7 ปีที่แล้ว

      Finally! yes, u were right i had some weird issue with the js of bootstrap, so i redownload it and also there was a typo in my sass file, so after that it just worked! damn im happy today xDDD. Thanks for all ^^

  • @learningdomaintv4969
    @learningdomaintv4969 6 ปีที่แล้ว

    Hi Allesandro - brilliant series up to now but I seem stuck here. My slider doesn't slide. Instead I see all the images one above the other.
    I cannot see where I might have gone wrong.

    • @alecaddd
      @alecaddd  6 ปีที่แล้ว

      Check my source code on GitHub if you have any issues.

  • @noorsultan2545
    @noorsultan2545 8 ปีที่แล้ว

    hi alex thank you so much you always great ,
    i have an issue with carousel is not uploading all my pictures he upload only the active
    function get only 1 picture the active one
    any help please
    multo graci alex

    • @GateWoodDigital
      @GateWoodDigital 8 ปีที่แล้ว

      Hey, double (triple!) check your code...
      github.com/Alecaddd/Sunset-theme/blob/master/Lesson%2025/template-parts/content-gallery.php
      If you're only getting 1 pic, check your foreach loop from line 24 where you are adding more pics ($i = 0 ... $i ++).
      Good Luck,
      Scott

  • @naeemafridi8295
    @naeemafridi8295 4 ปีที่แล้ว

    Thanks Dear Sir! but I have problem with a carousel of a gallery post. The images are not sliding and also showing other media objects like videos in carousel

    • @naeemafridi8295
      @naeemafridi8295 4 ปีที่แล้ว

      Sir! I apply your's code but not working. It's uploading pictures and videos from the media library automatically.

  • @paulmiller8128
    @paulmiller8128 6 ปีที่แล้ว +1

    Hi Alec,
    Sorry but I'm having problems.
    I'm getting the message "Warning: Invalid argument supplied for foreach() in.....\template-parts\content-gallery.php on line 26" which is "foreach( $attachments as $attachment ):"
    I've copied over your code from github a few times but no luck - any ideas please?
    Thanks

    • @alecaddd
      @alecaddd  6 ปีที่แล้ว

      Check if your $attachments variable is returning empty

    • @paulmiller8128
      @paulmiller8128 6 ปีที่แล้ว

      Hi Alec,
      Thanks for your answer.
      "var_dump($attachments);" returns "string(0) """ which I take it is empty.

    • @paulmiller8128
      @paulmiller8128 6 ปีที่แล้ว

      Hi again, I've just recopied the theme-support & content-gallery code from github again & it works perfectly! (This is exactly what I did 2 days ago - php drives me mad sometimes)
      Sorry for pestering you.

  • @patrick-dev
    @patrick-dev 6 ปีที่แล้ว

    First of all thanks you very much for this huge help from you , please i wanna ask you about the thing you did about the attachment being fake post thumbnail, actually it works great but the problem is that when i try to delete that attachment from the post and then reload another one, i still find the old one as thumbnail, so please should i always detach it manually to get the new one , or there is a way to detach it automatically ?

    • @alecaddd
      @alecaddd  6 ปีที่แล้ว

      That's a well known "issue" of WordPress of how it handles attachments, a bit annoying, and I'm not aware of a workaround, sorry

    • @patrick-dev
      @patrick-dev 6 ปีที่แล้ว

      Thanks For Your Help, I'm Gonna Try & Hope To Make it Work Automatically By Doing Something Tricky .

    • @patrick-dev
      @patrick-dev 6 ปีที่แล้ว

      I did Some of Gogling About the Carousel BS Component , Because it doesn't Work properly in the BS 4 Beta,
      yesterday when i was trying to do the thing in gallery P format , it didn't work , So Please Do you Have an Idea about that, because also the wp.org doesn't accept themes with deregistered core jquery

  • @sincerelincoln
    @sincerelincoln 7 ปีที่แล้ว

    Hi Alec, I am so thankful for your tutorials, as they have help me to increase my skills, I am having an issue with the slider. All my post formats work except for the slider please give me some pointers on where i went wrong. I have review the master files, and even copied the file over to my local host and the gallery did not show using your code. Thanks in Advance for any advice you can give me.

    • @alecaddd
      @alecaddd  7 ปีที่แล้ว

      Hi, thanks for watching. Do you have any error triggered in your console?
      Also, be sure you WP_DEBUG is set to true, in order to catch all the errors you could have.
      Happy Coding!

    • @sincerelincoln
      @sincerelincoln 7 ปีที่แล้ว

      Alessandro Castellani Hi alecc you respond thanks. I have no error plus I downloaded your master files and it's broke all the way up to lesson 63

    • @sincerelincoln
      @sincerelincoln 7 ปีที่แล้ว

      BTW my array for post gallery returns 0 so var
      dump does not show any thing but it works for all my other post formats.

  • @normandubois_design
    @normandubois_design 8 ปีที่แล้ว

    Hi,
    I'm having a strange problem.
    I'm trying to get all the attachments of a custom post type, like you explained in the video. Unfortunately I'm getting an empty array.
    You're code isn't working in my theme. I also tried to simplify it, but it doesn't work neither :(
    I'm using this code:
    $att = get_posts( array(
    'post_type' => 'attachment',
    'post_parent' => $post->ID,
    ));
    Do you have any idea?
    Thanks! :)

    • @normandubois_design
      @normandubois_design 8 ปีที่แล้ว

      Do you have an idea? I just can't get it working :( Thanks! :)

  • @dhruvmarwadi
    @dhruvmarwadi 5 ปีที่แล้ว

    i used a same functions but when i see preview all image see at once on my screen active is not applied.
    error: invalid argument supplied for foreach() in C:\wamp\www\wordpress\wp-content\themes\cool theme\template-parts\content-gallery.php on line 25.
    in my file line 25 as follow:
    24
    please help me as possible as quickly b'cause i give this problem pretty much time than i expected and yet is not solved

    • @denderu9861
      @denderu9861 5 ปีที่แล้ว

      missed semicolon in line 25 $i = 0;

  • @NIcoCuoreDiAnGeLo
    @NIcoCuoreDiAnGeLo 6 ปีที่แล้ว

    don't work foe me. I have WordPress version 4.9.5 and I tried to upload your project. no image is shown and if you upload a highlighted image it returns an error. Does it depend on the version of WordPress ??

    • @NIcoCuoreDiAnGeLo
      @NIcoCuoreDiAnGeLo 6 ปีที่แล้ว

      I think I've solved it. I deleted all the media and reinserted new images. Now it works, I do not know what could have happened ....

  • @8BlankWolf8
    @8BlankWolf8 8 ปีที่แล้ว +1

    Hello it's me again.
    Here (at 19:40) I will point at my comment in Part 19 of your Premium Wordpress Theme Videos. It's the same concept I you can find there. (You allready var_dumpt the "$attachments" array.)
    Greetings BlankWolf

    • @alecaddd
      @alecaddd  8 ปีที่แล้ว

      Thanks again for pointing this out.

    • @hishamhilmy8899
      @hishamhilmy8899 8 ปีที่แล้ว

      alessandro , the same problem with me , when i delete picture from post and updated post , i still have images in my carousel this reason i think cus you used media uploader attachment , but i don`t know how to fix that < but anyway your tutorial is amazing :)

    • @GateWoodDigital
      @GateWoodDigital 8 ปีที่แล้ว

      Yes, same.... Deleted image from post but it does not remove it from the Gallery Post. Can you help us fix this?
      GRAZIE!

  • @me.vs.disease.x3506
    @me.vs.disease.x3506 6 ปีที่แล้ว

    I can only get one attachement even if I passed the $num correctly. I have no idea what I am missing.

  • @zaheerabbasaghani7593
    @zaheerabbasaghani7593 7 ปีที่แล้ว

    Not working properly carousel displaying only one image, and images are not deleting .

  • @Tsukasa1929
    @Tsukasa1929 7 ปีที่แล้ว

    Alex is me again, i have 4 days trying to find something that happened to and i'm real stuck, the theme is not getting the standard post format and not getting the gallery, i ready try to rollback until i write the gallery, i use the code of github but still broken if you can give me any advise i really appreciate, like you say in the learning how to code video i have a lot of frustration lol

    • @alecaddd
      @alecaddd  7 ปีที่แล้ว

      What do you mean by "not getting the standard post format"?
      The formats don't appear in the admin panel or in the front-end index page?
      Cheers

    • @Tsukasa1929
      @Tsukasa1929 7 ปีที่แล้ว

      Edited: now is working but din't get the attached images it get the header image and the profile image, something must be bug or mb is my WP version 4.8.2, i delete the gallery post and try to make a new one again and is back as before no image, I'm done with gallery, i should pass to the link post format and see what happen ...

  • @nobir98
    @nobir98 5 ปีที่แล้ว

    First Of all Thanks for the tutorials Alex brother
    an issue is bugging me ( attachment related )
    *I don't know if it will helps or not*
    so I've my own solution
    First I grab the all image using
    *_$imgs = get_post_gallery( get_the_ID( ), false );_*
    this function *returns an array* with the information of all the image .
    for now I need all the IDs of all images that I've selected in the gallery post cause in future I might need all the info of an image such as title, caption, description, alt text ... so I did this
    *_$imgsIDs = explode( ',', $galleryInfo['ids'] );_*
    in this line of code *_$galleryInfo['ids']_* *returns strings* like this *"22,21,20,19"* .... so I explode it with coma.
    ( by the way *_$galleryInfo['src']_* *returns an array* with all the images URL )
    so I've now all the IDs of an array . In this situation you can do anythings with those Images IDs . whatever, Now I gonna loops all the IDs and grab the images
    *_foreach( $imgsIDs as $imgID ){_*
    *_echo wp_get_attachment_image( $imgID , 'large', false ) );_*
    *_}_*
    There you have all the image but more important this method is not the best this is what I've come up with ... So I can't guaranty :"(
    and sorry for my poor English :"(
    #Summary:::
    *_$imgs = get_post_gallery( get_the_ID( ), false );_*
    *_$imgsIDs = explode( ',', $galleryInfo['ids'] );_*
    *_foreach( $imgsIDs as $imgID ){_*
    *_echo wp_get_attachment_image( $imgID , 'large', false ) );_*
    *_}_*
    Happy Coding :D

  • @ARAR-xf8ho
    @ARAR-xf8ho 7 ปีที่แล้ว

    20 days of learning in wordpress. y slider doesn't work.my codes were matched based on ur github files. pls help boss. thnx

    • @alecaddd
      @alecaddd  7 ปีที่แล้ว +1

      Do you have any error in the console?
      What does it mean "doesn't work"?
      Can you be more specific?

    • @ARAR-xf8ho
      @ARAR-xf8ho 7 ปีที่แล้ว +1

      it is fixed now boss. some typo errors. my bad. anyways, i can't wait to see another tutorials from you for wordpress plugin from scratch. a big thumbs up for every tutorial u've made.

  • @noorsultan2545
    @noorsultan2545 8 ปีที่แล้ว

    my slide show doean't work any help please
    thank you alex

  • @TheGiakaama
    @TheGiakaama 7 ปีที่แล้ว

    HI, @Alessandro_Castellani, great videos though I have a problem, I'm following this tutorial and I have this function :
    function arh_get_attachment($num = 1)
    {
    $output = '';
    if (has_post_thumbnail() && $num == 1):
    $output = wp_get_attachment_url(get_post_thumbnail_id(get_the_ID())); else:
    $attachments = get_posts(array(
    'post_type' => 'attachment',
    'posts_per_page' => $num,
    'post_parent' => get_the_ID(),
    ));
    if ($attachments && $num == 1):
    foreach ($attachments as $attachment):
    $output = wp_get_attachment_url($attachment->ID);
    endforeach; elseif ($attachments && $num > 1):
    $output = $attachments;
    endif;
    wp_reset_postdata();
    endif;
    return $output;
    }
    and when I call
    I get \template-parts\gallery.php:11:string '' (length=0) the array is 0 .
    Any solution ?

  • @techroad1497
    @techroad1497 4 ปีที่แล้ว

    00:29

  • @techroad1497
    @techroad1497 4 ปีที่แล้ว

    29