Craig

  • ACF Illegal String Offset

    When using Advanced Custom Fields in WordPress, I often get and use a custom link field like this:

    <?php
    $link = get_field( 'link' );
    $link_url = $link['url'];
    ?>

    When doing this, PHP will gently remind me with a notice that I have used an illegal string offset.

    Warning: Illegal string offset ‘url’…

    The top result in Google send us to this ACF support page. I usually figure out the problem right away with these support links, but this one was a little difficult for me to follow, as it winds through some different possibilities, including a plugin conflict.

    The answer lies within the responses, though: “the field is returning false.” I often use ACF to check if a value is present on a page. If it is, something happens. The field return false if the field is NOT present on the page. That means the conditional is not true and PHP 7.1 considers this illegal for using a variable array.

    The solution is really simple and is the standard way of testing to see if the value is true or false: using a conditional.

    <?php 
    $link = get_field( 'link' );
    if ( $link) :
    $link_url = $link[ 'url' ];
    endif;
    ?>

    The code added was “if ( $link ) :” and it’s ending statement “endif;”.

    Here’s the ACF Link documentation for reference.

    This note is mostly so I can get to the answer quickly and learn it more deeply myself, but I hope it helps you if happen across it, too.

  • A Few Words on New Year’s Resolutions

    It’s January 2, 2020. Have you broken your New Year’s resolutions yet?

    I’d bet about half the people who make resolutions don’t even make it to Day 3. And that’s absolutely fine as long as they don’t give up or feel badly about themselves at this point.

    For me, I start thinking about things I want to change or do better in December. I give a couple of them a try throughout the month. For Christmas and New Year’s celebrations, I try to keep them in mind just a bit, which helps to curb the excesses that normally happen at this time of year.

    January for me is all about “practicing” resolutions in the form of habit-making behavior. For simple ones that don’t require much cognitive load, I’ll try to do them every day but don’t punish myself if I miss every now and again. That worked well for the habit of making my bed every morning, and now it’s hard to *not* make my bed.

    For the more complicated ones that require my body to cooperate, I’m much more lax about the process. I’ll do them for a couple of days and then probably miss a couple. Then I’ll up it to a few more consecutive days. About 3 weeks into this process, I’m usually ready to go for it every day. By the beginning of February, I’m in full-swing.

    My philosophy on making lasting changes is to keep the changes as small as possible on a day-to-day basis.

    This is especially helpful during and after the holiday season. Most of us eat and drink too much in December. It seems our bodies quickly adapt to too much of anything. Trying to completely reverse course to nearly nothing to eat and drink on exactly January 1 is next to impossible because our bodies go into panic mode almost immediately. If you haven’t noticed, your body will almost always win over whatever will power you thought you’d saved up by not using it during December.

    But if we just ease back to normal eating and drinking and then try to do a little less over the course of 30 days, our bodies don’t panic. We don’t have to do battle with our evolutionary instincts. Our bodies will agree to work with us instead.

    Once we’re rolling at the end of January and into February, it’s simple to keep going at that point. And I promise you, what you can accomplish over the course of 11 months is far more powerful than what you can do just in January.

    If you find this helpful or have any questions about it, feel free to leave a comment.

  • It’s Day 7 of my #500DaysTo50 project, and right on time, Vishy Anand, one of my chess heroes, turns 50 years old today.

    I’m sure I first heard of Anand when he was 14 and I was 13. Back then, I thought I was on the path of becoming a grandmaster player, and I figured I had plenty of time to catch up to him on my way to greatness. 36 years later, it’s obvious I’ll never be as good as he was at 13 years old!

    That’s one of the strange things about aging. Prior hopes and dreams simply must die – or at least be scaled back to reality. I still enjoy chess immensely, and I can be among the top 1-2% of all rated players in the world. But statistically, someone like Anand would beat me 100% of the time for up to 1,000 games in a row. That’s a big difference!

    I first realized I didn’t have that special thing that makes for greatness when I had to chance to play 3 tandem games with Peter Svidler in 1989 as part of the run-up to the Goodwill Games. I was 17, and he was 12.

    We easily won the first two games. In the third game, I couldn’t see the right way to conduct an attack, and we drew that one. Young Svidler was extremely upset. In perfect English, he went through a series of moves that I hadn’t even considered. He just saw the game in a different way. He had a genius for that it that I just didn’t have.

    I do remember being mostly OK with that, even though it was clear at that moment becoming a grandmaster was just never going to happen.

    Getting back to the present, Anand at 50 does give “old guys” like me great hope for our own future. Chess is a sport – yes, a sport! – for the young. He is one of only two World Top 20 players over 40 years old, and it’s just now becoming apparent he probably won’t be competing for the World Championship again.

    If he can remain *that good* at 50, we can all still hope to achieve our own amazing progress at more advanced ages.

  • Here we are on Day 3 of #500DaysTo50. I’ve been trying at this “career thing” for over 25 years now. If I’m asked the “what do you do” question now, I’m answering that “I’m an entrepreneurial web developer and online marketer”.

    That’s largely in keeping with how I’ve made my career. I formed my first company in 1996, my first successful company in 1999, and I’ve pieced together a bunch of other things since then based on my interests.

    One thing that has been an absolute constant for me is learning new things. And I realize a lot of that learning has been based on fixing gaps that were exposed in embarrassing ways.

    While running an online marketing agency, I didn’t have any real coding skills. One of our offerings was helping companies make sure their new websites were going to work well for SEO and SEM efforts. While we were great at that, we weren’t qualified to look through the actual PHP code our subcontracting agencies built for the websites. When our client’s site was due to go live, it turned out almost zero work had been done on the site, and we were able to launch exactly one page of the site.

    I swore I’d never let that happen again, and I learned PHP and the LAMP stack to be able to make sure I could be better prepared. I now develop WordPress sites for clients as a result. They do very well with the search engines due to my previous experience.

    Along the same line, in a business development meeting, I once said, “You can just give us access to your database, and we can build the sites automatically for you.” The CEO of the other company rightly replied, “Well, we’ll never give you access to our database, but we have an API.”

    I almost shut down my company at that point, but I chose instead to learn more about MYSQL and other databases and how APIs operate.

    But maybe I should have simply hired people who knew a lot more than I did to cover those weaknesses I had. I’ve spent about 5 years re-tooling instead, as I’ve always been disappointed that I couldn’t code. That’s meant a lot of financial sacrifices. Nobody I know would consider them smart career moves.

    But that’s how I work, and I can’t see myself stopping. It’s a Sunday morning, and I’m going through a course on ReactJS for a couple of big projects I have thrown myself into. I have others helping along the way, and I’m able to make a few small contributions as I get up to speed.

    It’s entirely possible my fear of public embarrassment has shaped my career in completely unreasonable ways. My hope is that the payoff in the end will be huge to make up for the lost time. We’ll see…

  • It’s Day 3 of #500Daysto50. I started this on Day 1, even though I’ve been suffering with a cold for around 10 days now. Honestly, it’s been getting me down more than a cold should. Why is that?

    I’ll be talking much more – way too much more for some people – about acetylcholine (a powerful neurotransmitter), but we’ll start with an extra small dose now.

    I suffer from an “above average” amount of acetylcholine in my system. (No reliable consumer-facing tests exists to prove this, but the evidence for that un-diagnosed diagnosis is super clear in my case.) That means all the regular symptoms of a common cold are heightened – runny nose, congestion, etc. In fact, most cold medicines contain anticholinergic properties, which suppress symptoms.

    So you might understand why I missed a day, and you’ll hopefully understand that when I miss a lot of other days in this set of 500 posts, it’s almost definitely due to acetylcholine.

    As I mentioned, lots and lots more of that to come…

  • 500 Days Until 50 Years

    As of today, it’s 500 days until I turn 50 years old. I promised myself I’d start writing more, so let’s get going. I’m not getting any younger after all. #500DaysTo50

    I have a lot to say, and I’ll start saying it tomorrow. My hope is to make this a daily practice and to cover all the hard parts as well as the joys and lessons of a man of a certain age…

  • Up and Running Again

    Wow…it’s been awhile. I’ve been so hard at work on client sites that I’ve completely ignored my own. That allowed an overwhelming amount of malware to build up in my account, and Bluehost shut me down. I’ve had to delete everything related to the style of the site, and now I suppose I’ll start over. Onward!

  • A New Era for Political Influence

    We’re just a few days away from opening Simplur to the world, and I couldn’t be more excited.  Pluralized Funds will be the equalizer for individuals to regain influence in our political system.  It took me 6 years to put all the pieces together for this, and all I can say right now is that it’s been worth it.  If there’s anything that can change the the power structure in our political system, it’s Simplur.

  • Deep Tissue Massage Denver

    I suffer from a shoulder injury of some kind.  Rather than going to a doctor, I tried deep tissue massage with Denver therapist Cat Alletto.  By the time I tried it, I was barely able to lift my arm and had trouble with simple tasks like taking milk out of the refrigerator.  I didn’t have much hope, as I’ve struggled with this on-and-off for years.  I could tell it wasn’t a muscle problem, but something with tendons and possibly even structurally due to bad posture perhaps.

    Cat quickly got to work on what I thought was completely the wrong area compared to where it hurt.  She found “trigger points” (or knots) and worked instensely on those.  If you’ve had deep tissue massage before, you’ll know this isn’t exactly a relaxing massage and can be painful.

    She was finished after about 20 minutes.  I felt some immediate relief, but the big surprise was the next day, when I felt and heard a “pop” in my shoulder.  Since that point about six months ago, I’ve been almost completely pain free with an occasional small adjustment.

    If you’re searching for deep tissue massage in Denver, you should give Cat a try.  She’s independent, so the cost is lower than at a spa.  Her energy is just right, too, so you feel both at ease and confident you’ll be back in action soon.

  • In the past few weeks, there’s been a real blow up over “scammy” Facebook game techniques from companies like Zynga.  There was also a very honest run-down of scam-related revenue techniques by Dennis Yu, who I had the chance to meet and work with very briefly at the first Startup Weekend.

    Essentially, the idea is to gain revenues by any means necessary.  And we’re not talking about a small amount of revenue either.  Zynga, the maker of Farmville (which I’ve never played by the way), makes about 1/3 of its estimated $250 million annual revenue stream through these scam-related offers.  It has agreed to take all of those offers out of its games, which is a big commitment.

    On the other hand, there are many opportunities for individuals to play in the game of making money by any means possible.  If you’re on even a few mailing lists of online marketing “gurus”, you’ll get countless offers to buy over-priced how-to guides on the process.  And the fact is, if you follow some of their formulas, you can indeed make some good money.

    I’ve always been hesitant to do these get-rich quick schemes – most definitely to my own financial detriment.  I started to question myself recently on exactly why it is I refuse to play these money-making games.  The answer I’ve come up with is that I’m the type of entrepreneur that needs to make a difference in peoples’ lives with the companies I start.

    Yes, I’d love to make buckets of money just like the next guy or gal.  However, doing so in a way that does nothing to help the individuals buying from me, or doing so in a way that does not create something new and different – well, I’m just not motivated by that.  I’m into the art of entrepreneurship for the art itself, you might say.

    Now, honestly, I can’t say I see anything wrong with a lot of the gurus out there.  A lot of them are really helping people to make more money and lead happier lives.  And if you find yourself in the category of doing the art of entrepreneurship for the money, then please go for it by all means.

    If you’re like me, though, do yourself a favor and unsubscribe from the gurus’ get-rich-quick scheme e-mail lists.  You won’t find what you’re looking for there.  In fact, it will probably make you feel worse.  We sensitive types tend to take offense when we see others making those buckets of money while we, the starving artists continue to starve! –