Updates from April, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • Frankie Jarrett 9:12 pm on April 27, 2012 Permalink | Reply
    Tags: heroized, ,   

    I’ve been HEROized as The Solution! 

    Last night was a very memorable night for me as my friends at X-Team unveiled my inner superhero, dubbing me as The Solution!

    The Solution

    When Frankie Jarrett isn’t living his passion for working in WordPress or making music, he’s the problem solving hero known as, The Solution!

    He was born with the amazing cerebral super power to solve any problem. Frankie can always figure out a way to communicate clearly with anyone. He is often there to listen and offer support to others, no matter how difficult their situation. Often Frankie only needs to say, “I’ll have to think about this problem a little”, and soon he has an exciting solution!

    No situation is too big or too small and there is no danger too great for him to face. Whether you are having a tough time remembering trigonometry for your math test, or you are stranded on the roof of a burning building, The Solution can always figure out the best way to rescue someone.

    Our hero also has the natural ability to inspire others, whether leading musical worship in his church or jamming with friends, Frankie uses his voice and musical talents to uplift and inspire those around him.

    When not saving the innocent, Frankie spends his time watching the History channel with his wife, whom he absolutely adores.

    Being HEROized is a true honor, and I am grateful to Dave and the rest of the team for recognizing me in this way.

    Now to create more solutions! :)

     
    • levininja 6:24 pm on June 20, 2012 Permalink | Reply

      Nice. I’ve always wanted to be known as a friendly (not necessarily neighborhood) problem-solver. It’s the servant-heart of a Christian software engineer. :-) Glad to see I’m not the only one.

      • Frankie Jarrett 9:35 am on June 21, 2012 Permalink | Reply

        Thanks, Levi!

  • Frankie Jarrett 5:36 pm on April 15, 2012 Permalink | Reply
    Tags: css, , , jquery, loop, ,   

    Add first and last classes to your loop without using JavaScript 

    So you’re a pixel-perfect designer who wants to keep control over your WordPress loop styles? Hell yeah! You’re already pretty cool in my book.

    You’ve probably got a fancy post separator, or a brilliant doodle to fit between your last post and the comments. Whatever the reason, you don’t have CSS class selectors for targeting the first or last posts in your archive – and you really need them.

    There are a lot of tutorials on how to achieve this with jQuery. But it’s not worth relying on JavaScript for something that can easily be done with a little PHP magic.

    First, insert this function into your functions.php file.

    Now, open up loop.php and replace post_class() with the newly created fjarrett_post_class().

    This new function accepts the same parameters as the original function, so you can use it the exact same way. The only difference will be that the first and last posts will be marked automatically with an appropriate class name. Enjoy total control. :)

    If this helped you in any way I’d love to hear about it in the comments!

     
    • joel 9:31 pm on September 11, 2012 Permalink | Reply

      thanks! this works perfect!!

    • Luis 6:08 pm on November 9, 2012 Permalink | Reply

      Great job I searched far and wide and found nothing, till I found this worked just as is thank you.

    • Nick Meagher 6:58 pm on February 26, 2013 Permalink | Reply

      Worked great! Thanks!

  • Frankie Jarrett 5:23 pm on April 6, 2012 Permalink | Reply
    Tags: , , ,   

    The simplest way to require/include wp-load.php 

    If you want to use WordPress functionality in a PHP file that exists outside of your WordPress installation then you need to include wp-load.php. Perhaps you could call this “hooking into WordPress”.

    Maybe you’re already using some sort of relative path method, like:

    <?php include '../../../wp-load.php'; ?>

    But this can create problems if directories change. You need a clean, dynamic way to get wp-load.php. So here is the simplest way to do it, with just two lines of code (place it at the very top of your file):

    1
    2
    3
    4
    5
    6
    
    <?php
     
    $parse_uri = explode( 'wp-content', $_SERVER['SCRIPT_FILENAME'] );
    require_once( $parse_uri[0] . 'wp-load.php' );
     
    ?>

    Short and sweet :)

    Disclaimer: This is intended for experimental and development purposes only. It is not advised to redundantly load WordPress on live production environments. But, why?

     
    • Christial Gold 3:12 pm on July 18, 2012 Permalink | Reply

      This makes the assumtion that the WP Content folder is named wp-content. While this is true for the default install it could be named anything. This can be defined in wp_config.php itself. For my web site it is e.g. mycontent.

      • Frankie Jarrett 3:43 pm on July 18, 2012 Permalink | Reply

        Yes, that’s correct. Thanks for the feedback!

      • Grant Landram 6:08 pm on December 10, 2012 Permalink | Reply

        Having the same issue (mine is called “content”). Any fix for irregular wp-content naming or locations?

    • ikkeaviy 2:19 am on October 29, 2012 Permalink | Reply

      where will i put the code?in what file?

      • Frankie Jarrett 12:47 pm on October 29, 2012 Permalink | Reply

        Whichever file you want to load that is outside of the WordPress templates. It must be a PHP file.

    • sy 9:51 am on November 2, 2012 Permalink | Reply

      Well, that save me some time. I was trying to make wordpress functions work on an ajaxed page. Is there some kind of shortcoming/pitfall for this method as opposed to writing an ajax function in the function.php file other than what Christian Gold mentioned?

    • sy 9:53 am on November 2, 2012 Permalink | Reply

      Nevermind I read that disclaimer.

    • peyman 6:26 am on February 14, 2013 Permalink | Reply

      Thank you very much
      I am looking for this for a long time!!!!

    • Nikita 9:56 am on February 20, 2013 Permalink | Reply

      I made some simple function which can also detect path if there’s no wp-content folder.
      function wp_path() {
      if (strstr($_SERVER["SCRIPT_FILENAME"], "/wp-content/")) {
      return preg_replace("/\/wp-content\/.*/", "", $_SERVER["SCRIPT_FILENAME"]);
      }
      return preg_replace("/\/[^\/]+?\/themes\/.*/", "", $_SERVER["SCRIPT_FILENAME"]);
      }

      Usage:
      require wp_path() . "/wp-load.php";

    • MED 11:06 pm on March 17, 2013 Permalink | Reply

      Thank you very match ;)

    • Lori 5:13 pm on March 25, 2013 Permalink | Reply

      You saved my sanity when my slider-builder wasn’t loading!
      Thank you – excellent advice!

    • Daniel Lemes 11:49 pm on June 10, 2013 Permalink | Reply

      Thank you, really “short and sweet”.

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel