Part 38 - WordPress Theme Development - Bug fixes and Code Improvements

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ม.ค. 2025

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

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

    Again, a very good tutorial with more background then the usual tutorials. Love the fact that we're getting homework assigned. Although at this point in time i'm too busy to get really involved. I'm following your tuts from day one and an amazed every time again that you can solve issues with a few lines of code or css. Sometimes difficult for me to wrap my head around, but then I watch your tut and everything makes sense.
    Grazie Mille sensei ;-)

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

      +fam Schrikkema Ahahahaha, that is amazing, thank you so much!
      That's one of the main reasons I love coding so much. It doesn't matter how hard or insane is your problem, there will always be a good, linear, easy way to solve it. Nothing is impossible. And if something is actually impossible for technical reason, give it a couple of months and someone else will have a completely new scripting language or method to solve everything.

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

    WOW... I am very impressed... things are slowly coming together.

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

      Getting good, right? :D

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

      @@alecaddd yes sir...

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

    THX for this very important bugfix-episodes, since we developers must do that on a daily basis. Sometimes I feel like there has to be a whole new video-series, just about bugfixes and workarounds. ;-)

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

      +CyberIllusions I was actually thinking to do a full debug series live with the audience. Like I build a small app or plugin, and then everyone can access it and try it, leave comments or issues, maybe we could use a bug tracker, and then fix all those issues during a Live Dev session.

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

      Sounds interesting to me, Alex! Just tell me if and when it's gonna happen.I'm down. ;-)

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

    Thanks a lot for your awesome tutorials and quality on explanations. Great job!!!.
    I was wondering if you could do one about the customizer API, which WordPress has pushed so much and what is your perspective in this API, when if you use to give the user a better experience to teak a theme.
    Thanks again!!!

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

      +Ibán López I did an episode on The Nerd Continuity about the new WordPress updates, and my thoughts on the Customizer API. th-cam.com/video/ylvmz561QeA/w-d-xo.html
      It's a bit long, and I definitely talk to much, but I'm really interested in your opinion.
      Thanks for watching!

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

      +Alessandro Castellani thanks a lot

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

    Allesandro, I've noticed that in your JavaScript and also your PHP you sometimes wrap strings in single quotes and other times you wrap them in double quotes. Is this something that you're doing on purpose or do based on some sort of standard or is it something that really doesn't matter. Really appreciating your tutorials! Well done.

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

      It doesn't matter if you're just echoing or printing a string. Their behavior and usage changes in both PHP and JS if you need to print specific variables. Here's a couple of info:
      PHP: www.quora.com/What-is-the-difference-between-single-quoted-and-double-quoted-strings-in-PHP
      JS: staxmanade.com/2018/03/should-i-use-javascript-single-or-double-quotes/

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

      Thank you so much Allesandro! God bless.

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

    I'm glad I could help free your mind... :p) As far as the ajax.php file, I was trying to loop through using a foreach and break out if the $archVal was found but couldn't get it to work. I like your current method and the fact I just learned about two more array functions in the process! You 'da man!

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

      +Mark Waters You gave me the right boost and forced me to look at the issue from another angle, thank you so much!
      I didn't even ask if it was ok for you to make your name and face appear in the video. Sorry about that.
      I'm glad this episode was interesting for you.

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

    This code also handles the issue with having 2 Gallery Posts on the same page. Both posts function as expected. It's a simple matter of attaching the js slider code to the specific object by retrEEEEEEEEEEving (not retrIIIIIIIIIving) the object by its class, checking if it has a slid event, then attaching one if not. SUPER SIMPLE SIMON...

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

    if i enter the normal post link and scroll down my url gets stripped from localhost/standard-blog-post to localhost. Any suggestons on how to fix this? Im using xampp. Tnx in advance

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

      The function I'm using works perfectly for a standard url scenario, so something like www.yoursite.com. If you're on localhost without a vhost configured, you can edit the function or the data attributes, to maintain your URL structure.

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

      on the next tutorial when i created single.php it doesnt get striped. I think its because it thought it was on index.php and now its not so is working good.

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

    Perhaps a switch statement would do the trick in this case

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

      Yup, also

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

    I'm a bit late ^___________^

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

      +YA SUO Nah, on the web you're never late. Did you have a code improvement to suggest? You can commit it to my GitHub repo, and if it's good I will implement it and add it to the video!

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

    Quite a lot of code for a "Super Simple" solution.
    Your rationale to use IDs for the images and all that extra code does not seem sensible, given your "Super Simple" philosophy...
    Here is an even simpler solution:
    First, create a helper function in the sunset.js file:
    function set_slider_code( carousel ) {
    if ( $(carousel).length ) {
    $('.carousel').each(function (i, obj) {
    if ( $._data(obj, 'events') === undefined ) {
    // console.log('Adding event slid: ' + i );
    $(obj).on('slid.bs.carousel', function () {
    sunset_get_bs_thumbs(carousel);
    });
    }
    });
    sunset_get_bs_thumbs(carousel);
    }
    }
    The $(carousel).length is a simple way to check if the object exists on the page (since jQuery doesn't have an exists() function).
    If there is a carousel object [$(carousel).length] (based on the class), then cycle through all the carousel objects and check if there are any event functions attached to it [$('.carousel').each...]. If not, add the slid event. This assumes that there are no other events attached to a carousel. Otherwise, additional code could check if there more events than the 'slid' event, then check for the existence of the specific 'slid' event.
    SUPER SIMPLE...
    Next, modify the ready function:
    Keep the var declaration and add a call to the new helper function:
    /* variable declarations */
    var carousel = '.sunset-carousel-thumb';
    var last_scroll = 0;
    /* carousel functions */
    set_slider_code( carousel );
    Then add the helper function call to the success function of the ajax call. This is to check when dynamic content is loaded and there exists a new or additional slider class object:
    if ( response == 0 ) {
    $('.sunset-posts-container').append(
    'This is the end of the Posts!No more posts to load...'
    );
    that.slideUp(320);
    set_slider_code( carousel );
    } else {
    setTimeout( function() {
    if ( prev === 1 ) {
    $('.sunset-posts-container').prepend( response );
    newPage = page - 1;
    } else {
    $('.sunset-posts-container').append( response );
    }
    if ( newPage == 1 ) {
    that.slideUp(320);
    } else {
    that.data('page', newPage);
    that.removeClass('loading').find('.text').slideDown(320);
    that.find('.sunset-icon').removeClass('spin');
    }
    set_slider_code( carousel );
    revealPosts();
    }, 1000 );
    }