AI Wrote This. AI Will Read It. So Why Are You Here?

I spent three hours writing a post last month. I rewrote the opening four times. I deleted an entire section because it felt too whiny. I added a personal story I wasn’t sure I wanted to share. I changed the title eleven times.

The post went up. Got a decent amount of impressions. Someone commented: “Great post! I asked AI to summarize this and shared it with my team.”

I stared at that comment for a long time.


Here’s What’s Actually Happening

AI is writing a massive percentage of content on the internet right now. Blog posts, newsletters, LinkedIn articles, SEO pages — a huge chunk of what you’re seeing was generated in seconds by a model trained on everything humans wrote before.

At the same time, people are using AI to read the internet. Perplexity. ChatGPT. Google’s AI summaries. NotebookLM. You ask a question, an AI reads ten articles, and gives you three bullet points. You close the tab. Done.

So we have: AI writing → AI reading → human gets a summary.

Which means, increasingly, the content pipeline looks like this:

  • A machine writes 1,500 words
  • Another machine reads those 1,500 words
  • A human reads 4 sentences
  • Everyone calls it “staying informed”

And I keep thinking: what is even the point?


I Don’t Think It’s Nothing. But I Think We Need to Be Honest.

Let me be real with you. I write on this site because I have things I want to say. Real things, from real experiences, about stuff I’ve actually felt or figured out. That matters to me.

But there’s a difference between me writing and a content farm pumping out 300 articles a day using GPT-4 and a WordPress plugin. And here’s what bothers me: to the AI summarizer, there’s no difference. It compresses both the same way. The algorithm doesn’t know I rewrote my opening four times. It doesn’t know I deleted the whiny part. It doesn’t know I hesitated before sharing that story.

All it knows is: this article is about X. Here are the main points. Done.

The compression removes the human. And when you add AI-generated source material into the mix, you’re now reading a machine’s summary of a machine’s interpretation of something nobody actually lived through.

That’s not information. That’s a very efficient echo chamber.


Why People Still Write (And Why It Still Matters)

Here’s what I’ve landed on: writing is not just about transferring information. If it were, you wouldn’t need stories. You wouldn’t need examples. You wouldn’t need voice or tone or the specific way someone phrases a hard truth.

You write because writing is how you figure out what you actually think. You write to be witnessed — to say “this is what it felt like,” and have someone else say “yes, me too.” You write to change someone’s mind slowly, through the weight of how you build an argument, not just the conclusion.

AI can do the conclusion. It can’t do the weight.

A summary can tell you someone argued that financial anxiety limits your career risk-taking. But reading the actual piece — the one where the writer describes sitting in a parking lot before a difficult conversation about their salary, heart rate up, rehearsing what they were about to say — that does something different to you. That reaches somewhere the bullet points can’t.

The question is whether people still want that. Or whether we’ve collectively decided that being efficient is more important than being moved.


The Part That Actually Worries Me

It’s not that AI writes content. Fine. Tools exist. People use them.

What worries me is the feedback loop. AI writes average content → AI reads and summarizes average content → humans train themselves to expect average content → AI learns from human behavior that average content is what’s wanted → more average content is made.

Somewhere in that loop, the extraordinary stuff gets starved out. Not because it isn’t better, but because it doesn’t fit the pipeline. It’s too specific. Too personal. Too weird. Too human.

The things that genuinely change how you see yourself or the world tend to be a little uncomfortable to read. They take something from you. They require you to sit with something instead of clicking away. They don’t compress cleanly into bullet points because the point isn’t in the conclusion — it’s in the journey to get there.

That kind of writing will always exist. But it might become harder to find in a sea of perfectly competent AI-generated content that technically answers the question and leaves you completely unchanged.


What I Think You Should Actually Do

I’m not going to tell you to boycott AI tools. That’s not realistic, and honestly it misses the point.

But I will say this: the next time you’re about to ask AI to summarize an article, ask yourself what you’re really after. If you need a fact, a date, a quick overview — fine, summarize away. But if you’re reading something because you want to understand something better, because you want a different perspective, because someone wrote something that might actually shift how you think about your life — read it yourself. The whole thing. Slowly.

Not every piece of writing deserves that. A lot doesn’t. But some does, and the only way to find out which is which is to be present for it.

And if you write: keep writing like it’s going to be read by a human who has thirty unread tabs open and still chose yours. Write something that earns the stay. That’s the only answer to the AI loop that actually works.


The person who commented on my post — the one who asked AI to summarize it and forwarded the summary — probably shared something useful with their team. The information moved. The insight propagated.

But they’ll never know about the parking lot. They’ll never know I almost didn’t write it. They’ll never feel the specific weight of the sentence I spent forty minutes on.

And that’s fine. Not everything needs to be felt.

I just think some things do. And I hope we don’t optimize that away.

The Real Reason You Procrastinate (And It’s Not Laziness)

I used to think I was just a lazy person. That had to be it, right? Smart enough to know what I needed to do, disciplined enough to keep a tidy calendar, fully capable of doing the work — and yet there I was, not doing it. Watching the deadline approach like a train I could see but couldn’t move away from.

It wasn’t until I started actually examining what happened in the hours before I’d avoid a task that I noticed something: it wasn’t boredom. It wasn’t tiredness. It was a specific, low-grade dread. A feeling I eventually recognized as fear.

Not fear of the task itself. Fear of what doing the task might reveal.

Procrastination Is Self-Protection That Backfires

Here’s the thing about procrastination that nobody says clearly enough: it’s not a discipline problem. It’s usually a fear problem dressed up as a discipline problem. And the reason it’s so hard to address is that if you misdiagnose it, you apply the wrong fix. More pressure, more guilt, more “just do it” energy — none of which touches the actual issue.

The fear underneath procrastination usually comes in a few flavors:

  • Fear of failure. If you don’t try properly, you can’t properly fail. The incomplete attempt always comes with a built-in excuse — you didn’t really give it your best, so the result doesn’t really count.
  • Fear of judgment. Starting means producing something. Producing something means other people can see it and evaluate it. Not starting keeps you safe from that.
  • Fear of discovering your limits. This one is subtle and brutal: some people avoid starting because starting might reveal that they’re not as capable as they hope. Staying in “I could do this if I started” is safer than finding out what actually happens when you try.

I lived in that last one for a long time. There was a project I genuinely cared about that I put off for almost eight months. Not because I didn’t have time. Because I was terrified that if I gave it everything and it wasn’t good enough, I’d have to update my whole story about myself. As long as I hadn’t tried, the possibility remained. Delay was protecting the dream.

Why Waiting Makes It Worse

Here’s the cruel mechanic of it: the longer you wait, the more the fear grows. Because now you’ve built it up. Now it’s not just the original task — it’s the task plus the weight of all the time you’ve already avoided it, plus the guilt, plus the self-judgment. The mountain gets taller the longer you stand at the bottom.

And the brain registers the relief you feel when you put something off as a reward. That’s the trap. Avoidance feels good in the short term. So your brain learns to chase that relief, which means more avoidance, which means more guilt, which means more dread, which means more avoidance. The cycle is self-reinforcing.

You’re not getting lazier. You’re getting more afraid.

Breaking the Pattern (For Real)

The good news — genuinely good news — is that fear is a more solvable problem than laziness. You can work with fear. You can reason with it, expose it, shrink it down to size. Laziness is a character trait. Fear is a response to something specific, and specific things can be addressed.

What actually helped me:

  1. Name the fear explicitly. Not “I don’t feel like doing it” — that’s the costume. What are you actually afraid of? Write it down. “I’m scared this won’t be good enough and people will see that.” Making it concrete makes it smaller.
  2. Separate the task from the outcome. You can control whether you show up and do the work. You cannot control how it’s received. Focus on what’s yours to control and let the rest be what it is.
  3. Use a five-minute rule. Commit to doing the thing for five minutes only. Just five. The hardest part is starting. Once you’re moving, finishing is usually easier than you imagined.
  4. Make failure cheaper. A lot of fear-based procrastination assumes failure is catastrophic. Is it? Actually? Usually a failed attempt teaches you more than not trying, costs less than you feared, and rarely ends careers.

You’re Not Lazy

If you’ve spent years calling yourself lazy, I want to offer you a different frame: you’re not lazy. You’re scared. And that’s actually a more honest and more hopeful diagnosis.

Lazy people don’t feel guilty about not doing things. They don’t lie awake running through the list of what they didn’t finish. They don’t feel the weight of the undone work following them around. That guilt? That’s evidence of someone who cares. Who wants to do more. Who is being stopped by something other than not caring.

Figure out what you’re actually afraid of. Start there. The task is usually easier than the fear of it.

If you want to talk through what’s keeping you stuck, reach out — this is something I’ve navigated personally and think about a lot.

Why You Work Hard But Still Feel Empty

I remember the day I got promoted. The role I had worked toward for almost three years, the one I’d taken on extra projects for, stayed late for, restructured my entire life around. When it finally happened, I sat in my car after the meeting and waited to feel something.

I felt… nothing. A thin kind of relief, maybe. But mostly flat. Empty. Like the finish line had just moved again and the whole race had been pointless.

I didn’t tell anyone that. You don’t say “I got the promotion and I feel hollow” when everyone is expecting celebration. So I posted something positive and went back to work and quietly wondered what was wrong with me.

Nothing was wrong with me. But something was wrong with the way I’d been operating.

The Hedonic Treadmill Is Real

Psychologists have a name for what happened: the hedonic treadmill. The idea is that humans rapidly adapt to new circumstances — good or bad — and return to a baseline level of happiness. The promotion you worked for becomes normal. The apartment upgrade becomes just where you live. The salary bump becomes what you’re used to. And the moment it’s normal, the hunger starts again for the next thing.

This isn’t a character flaw. It’s biology. But understanding it is the first step to not being controlled by it.

The problem isn’t ambition — ambition is fine, it moves things forward. The problem is when the goal becomes the only source of meaning, and the achievement of the goal doesn’t deliver what you expected. So you immediately redirect to the next goal. And the next. And you stay permanently in pursuit without ever arriving anywhere that feels like enough.

Confusing Achievement With Meaning

I spent a long time chasing things that would prove something. Prove I was capable. Prove I’d made something of myself. Prove the earlier struggles were worth it. And achievements can do that — temporarily. They can quiet the self-doubt for a moment. But they don’t fill the gap that was there before you started chasing, because the gap isn’t an achievement problem. It’s a meaning problem.

Meaning comes from something different. Not from what you accomplish, but from why you’re accomplishing it, and whether the work connects to something larger than your own resume. Work can be fulfilling — genuinely fulfilling — but only when there’s intention underneath it. Not just targets.

Ecclesiastes understood this. “Vanity of vanities, all is vanity.” Not a call to stop working — a warning against doing the work while missing the point. The endless striving without asking what you’re actually building toward.

What Hollow Feels Like (And Why It’s a Signal)

If you’ve felt that emptiness after achieving something you worked hard for, it’s not a sign you need to work harder or aim higher. It’s a signal worth paying attention to:

  • Are you chasing this because you genuinely want it, or because you think you should want it?
  • Would reaching this goal change how you feel about yourself, or just your circumstances?
  • Is there something underneath the goal — an identity, a fear, a wound — that the goal is trying to fix?
  • Are you running toward something, or running away from something?

These aren’t easy questions. But they’re more useful than just adding more targets to the list.

Hard Work Without Intention

Hard work without intention is just exhaustion with a good PR team. It looks productive. It generates results. But it doesn’t generate satisfaction, because satisfaction isn’t a byproduct of effort alone — it’s a byproduct of effort aimed at something that matters to you personally, not just something that looks impressive from the outside.

What you chase matters as much as how hard you chase it. Two people can work equally hard and have completely different relationships with their results depending on whether the goal was theirs or borrowed from someone else’s definition of success.

The Fix Isn’t Stopping

I’m not saying stop working hard. I’m saying figure out what the work is for — actually for, not what sounds good in a LinkedIn post. And if the honest answer is “I don’t know” or “I haven’t thought about it,” that’s the most useful piece of self-knowledge you could have right now.

The emptiness isn’t a sign you need more. It’s a sign you need different. More aligned. More intentional. More connected to something that doesn’t evaporate the moment you hit the target.

Build that, and the work starts to mean something. Ignore it, and you’ll spend years winning races that leave you exactly where you started — except more tired.

If any of this resonates and you want to think through it together, feel free to reach out. I’ve spent a lot of time in this particular maze.

The Friend You Keep Because You’ve Known Them Long Enough

There’s a specific kind of friendship that most people don’t talk about honestly — the one you keep not because it’s good for you, but because it’s old. You’ve known them for ten, maybe fifteen years. You grew up together, or you went through something hard together, and that history feels like it means something. Like you owe it something.

I kept one of those friendships for years longer than I should have. And the cost wasn’t dramatic. There was no big betrayal, no public blowup. It was quieter than that — a slow drain. A low-grade exhaustion I couldn’t explain until I finally stopped and looked at who was causing it.

History Is Not the Same as Value

We have this idea that the length of a relationship is evidence of its worth. Ten years of friendship must be worth more than two years of friendship. And sometimes that’s true — shared history does mean something. Context matters. Depth takes time.

But sometimes all it means is that you’ve known someone long enough to feel obligated. Duration is not the same as depth. And loyalty to the past is not the same as wisdom about the present.

This particular friend and I had grown in completely opposite directions. Not just different interests — different values, different ways of treating people, different things we thought were acceptable. But every time I’d distance myself a little, the history would pull me back. “You’ve known them for a decade,” my brain would say. “You can’t just walk away from that.”

Yes, I could. I just didn’t know how to let myself.

The Real Cost of Staying

What does it cost to keep a friendship that’s past its expiry date? More than most people account for.

Energy is the obvious one. The kind of friendship where you brace yourself before every call, where you’re already mentally preparing for drama before you’ve even said hello, where you leave every interaction feeling slightly worse than when you started — that costs something. And energy is finite. Whatever you’re spending on the wrong people, you’re not spending on the right ones.

But it also costs growth. Some friendships are quietly hostile to change. The person knew you when you were struggling, when you were small, when you made bad decisions — and somewhere in them, consciously or not, they want you to stay there. When you start improving, they reframe it as betrayal. “You’ve changed.” “You’re not the same person anymore.” “You think you’re better than everyone now.”

They’re right that you’ve changed. That was the point.

Loyalty Has Limits

Loyalty is a real virtue. I believe in it. But loyalty is only a virtue when it’s pointed at people who deserve it. Loyalty to someone who consistently drains you, dismisses your growth, or brings chaos into your life isn’t noble. It’s just sunk cost bias with a moral label on top.

You don’t owe anyone your peace because you’ve known them a long time. You don’t owe anyone access to your life because of a shared past. Relationships earn their place not through history alone, but through what they actually add — or subtract — from your daily reality.

How to Know When It’s Time

You don’t always need a dramatic reason. Sometimes the sign is quieter than that:

  • You feel relieved when they cancel plans
  • You share less and less of your real life with them
  • You leave their company consistently feeling worse, not better
  • The friendship only works when nothing in your life is changing
  • They’re a bigger presence in your stress than in your joy

If several of those are true, the friendship isn’t built on anything healthy anymore. It’s just momentum.

Outgrowing Is Not Betrayal

Here’s what I had to tell myself before I could let that friendship go: outgrowing someone isn’t a betrayal. It’s just growth doing its job. You’re not abandoning them. You’re being honest — about who you are now, who they are, and whether those two people should still be as tightly bound as they once were.

You can honor the history without being a prisoner to it. You can appreciate what someone meant to you at a certain season of your life without signing up for every season that follows.

Life is short enough. Spend it with people who actually make it better.

If you’ve been sitting on a friendship that’s quietly costing you more than it gives — I’d love to hear from you. You’re probably not alone in it.

Stop Waiting Until You Feel Ready

I spent almost two years “getting ready” to start something I cared about. I had a list of things I needed to do first — courses to finish, money to save, skills to sharpen, confidence to build. It was a very organized list. A very convincing one. I could defend every item on it.

Then someone else launched almost exactly what I had been planning. Same niche, same angle, same format. They just… started. Before they were ready. Before everything was figured out. And they figured it out on the way.

That’s when I understood how expensive waiting is.

Readiness Is a Feeling That Never Comes

“I’ll start when I feel ready” is one of the most damaging sentences in the self-improvement vocabulary. It sounds responsible. Thoughtful, even. But what it really means is: I’m going to wait indefinitely for a feeling that won’t arrive on its own.

Nobody feels ready for the big things. Nobody felt ready to start their business, change careers, leave a bad relationship, move to a new city, have a difficult conversation, or bet on themselves. The people who did those things didn’t feel ready. They just stopped treating the feeling as a prerequisite.

Think about the last time you did something genuinely new and hard. Did you feel ready going in? Probably not. Did you figure it out anyway? Probably yes.

Waiting Is Procrastination With a Better Excuse

Here’s what I’ve come to believe: waiting for readiness is procrastination that’s learned to wear a professional outfit. It has a briefcase and a calendar and a list of reasonable-sounding requirements. But underneath, it’s fear. Fear of starting and failing. Fear of starting and discovering you’re not as good as you imagined. Fear of being judged before you’ve had time to get good.

The “getting ready” phase can last forever if you let it because there’s always one more thing you could learn, one more resource you could read, one more reason to wait for better timing. There is no better timing. There’s now and there’s the version of you that never started.

Proverbs 13:4 says the soul of the sluggard craves and gets nothing, while the soul of the diligent is richly supplied. That stuck with me — not because it’s harsh, but because it’s accurate. Craving without acting is its own kind of failure.

What Starting Actually Does

Readiness isn’t a feeling you wait for. It’s a result of starting. You get ready by doing the thing badly at first, then less badly, then eventually well. That’s the actual sequence — not learn everything, feel ready, then start. You learn by starting. There’s no shortcut and there’s no version where you skip the awkward early phase.

The business you keep “almost” launching? You’d have had two years of data by now. The skill you keep meaning to develop? You’d be good at it already. The conversation you keep putting off? It’s sitting there costing you energy every single day.

A Few Things That Actually Helped Me

  • Set a “bad launch” date. Give yourself permission to start imperfectly on a specific date. Not perfectly — just started. The bad version is infinitely more valuable than the perfect version that doesn’t exist.
  • Separate preparation from procrastination. Ask yourself honestly: “Am I learning something that moves me forward, or am I staying in research mode because it feels safer than doing?” If it’s the latter, close the tab and start.
  • Make the first step embarrassingly small. Not “launch the business” — “send one email.” Not “change careers” — “update one section of my resume.” Small starts break the stuck feeling.
  • Find someone who started messy and succeeded anyway. There are millions of them. Study their actual timeline, not the highlight reel.

The Version of You That’s Ready

Here’s the honest truth: the version of you that feels confident, prepared, and ready is built by the version of you that started scared. There’s no path to ready that doesn’t go through doing. You’re not waiting for a better version of yourself to show up — you’re avoiding the process that builds them.

Start the thing. Start it badly. Start it scared. Start it before you’re ready. That’s the only way readiness ever actually arrives.

Whatever it is you’ve been postponing — the gap between where you are and where you want to be is exactly the length of time you keep waiting. Close the gap. Start today.

If you’re stuck on where to begin with something, feel free to reach out — I write about this stuff because I’ve lived most of it the hard way.

Why You’re Still Broke Even Though You Have a Good Job

Let me be honest with you. A few years ago I landed a job that paid almost double what I was making before. I remember thinking — finally, this is it. I’m going to build savings, pay off debt, maybe even invest for the first time. I had plans. Real ones.

Six months later I was still broke. Not struggling-to-eat broke, but the quietly-anxious kind — checking my account before every purchase, living paycheck to paycheck, wondering where the money went.

The salary went up. The savings didn’t. What happened?

Lifestyle Inflation Is Sneaky

The problem has a name: lifestyle inflation. Also called lifestyle creep. It’s the pattern where your spending quietly rises to match — or slightly exceed — whatever you’re earning. More money comes in, more money goes out, and somehow the gap between the two never changes.

It doesn’t feel like a choice. That’s what makes it dangerous. Nobody sits down and thinks, “I’m going to start spending an extra $800 a month now.” It just… happens. The nicer gym. The upgraded apartment. The restaurants you wouldn’t have looked at before. The random Amazon orders that feel justified because hey, you’re earning more.

Your brain adjusts to new normals terrifyingly fast. What felt like a luxury three months ago feels like a baseline today. And once something becomes your baseline, cutting it feels like deprivation — even if you were perfectly fine without it a year ago.

The Numbers Tell the Story

Here’s what I did after my salary jumped. Instead of redirecting the extra money with intention, I just… let it absorb. New rent (nicer neighborhood). Better car payments. Upgraded subscriptions. Eating out more because I “deserved it” after long work weeks.

None of these things were bad in isolation. The problem was that I made all of them at once, without a plan, and told myself I could afford it because I was earning more. I could technically afford each item. I just couldn’t afford all of them together while also building wealth.

That’s the trap. You can afford the individual pieces and still be broke at the end of the month.

Earning More Won’t Fix It Alone

This is the part nobody wants to hear: if your spending habits don’t change, a higher salary just funds a more expensive version of your current life. That’s it. You’re not building anything. You’re just playing a bigger game with the same losing strategy.

I’ve watched people go from $45,000 to $80,000 a year and still have nothing to show for it five years later. The income changed. The mindset didn’t. The spending followed the income upward the entire time.

It’s not a money problem. It’s a pattern problem.

What Actually Helps

I’m not here to tell you to stop having fun or eat rice every day. But these things changed how I think about money:

  1. When income goes up, automate savings first. Before lifestyle adjusts, move the difference — or at least a chunk of it — somewhere you won’t see it. If you never see it, you can’t spend it.
  2. Audit every recurring charge once a quarter. You’ll find things you forgot you were paying for. Subscriptions pile up invisibly.
  3. Be intentional about upgrades. Not every upgrade is wrong. But make it a deliberate choice, not a passive drift. Ask: “Am I choosing this, or am I just adjusting to it?”
  4. Track spending for one month. Just one. Not forever. Just long enough to see the real picture. Most people are shocked.

The Real Goal

The goal isn’t to earn a bigger salary. Plenty of high earners are quietly drowning. The goal is to build a bigger gap — the space between what you earn and what you spend. That gap is where freedom lives. That gap is what turns into savings, investments, options.

A $50,000 salary with a $10,000 gap is better than a $90,000 salary with no gap. Every time.

You didn’t get the job to keep being broke. You got the job to have choices. Start spending in a way that gives you those choices.

If this hit close to home, feel free to contact me — I write about money, growth, and the stuff nobody talks about honestly enough.

How to make a slots machine effect counnter using HTML and CSS

25
24
22
20
18
16
14
12
10
08
06
04
02

Years

<style>
.experience_counter {
        display: flex;
        flex-direction: row;
        align-items: center;
        font-weight: 700;
        font-size: 32px;
        line-height: 1em;
        font-family: "Poppins", Sans-serif;
        color: #FFF;
        gap: 8px;
      }
      .experience_counter .container {
        height: 40px;
        overflow: hidden;
      }
      .experience_counter .slides {
        height: 480px;
        margin-top: -480px;
        will-change: transform; 
      }
      
      .experience_counter .slides{ animation-name: experience_counter;
          animation-duration: 1s;
         animation-delay: 3s;
        animation-fill-mode: forwards;
        animation-timing-function: ease-out; }
        
      .experience_counter .slide {
        height: 40px;
        display: flex;
        align-items: center;
      }

      @keyframes experience_counter {
        from {
          transform: translateY(0);
        }
        to {
          transform: translateY(480px);
        }
      }
</style>

<div class="experience_counter">
      <div class="container">
        <div class="slides">
          <div class="slide">25</div>
          <div class="slide">24</div>
          <div class="slide">22</div>
          <div class="slide">20</div>
          <div class="slide">18</div>
          <div class="slide">16</div>
          <div class="slide">14</div>
          <div class="slide">12</div>
          <div class="slide">10</div>
          <div class="slide">08</div>
          <div class="slide">06</div>
          <div class="slide">04</div>
          <div class="slide">02</div>
        </div>
      </div>
      <span>Years</span>
    </div>

 

WordPress Posts/Blogs Filter with Search and Category Select/Dropdown, No Plugins

Take a look at the example inside the box below.

  1. We have a search box.
  2. We have category select box.
  3. We have a list of posts.
  4. We have a “load more” button.
  5. When we type anything on the search box it automatically filters the listed posts.
  6. If we select anything on the category, it filters the posts by category.
  7. Dynamically, the search box and the category select box work together. If we select a category, and type in keywords, it will only search and filter the post lists under that category.

Demo Example:


So how did I do that? It is simple, look at the code down below. Add it to your functions.php file.

// These lines of code register the 'custom_filter_posts' function to be called when an AJAX request with the action 'custom_filter_posts' is received.
add_action('wp_ajax_custom_filter_posts', 'custom_filter_posts');
add_action('wp_ajax_nopriv_custom_filter_posts', 'custom_filter_posts');

function custom_filter_posts() {
    // These lines retrieve the keyword, category, page number, and posts per page values from the AJAX request's parameters. If any of these parameters are not provided, they default to empty string, 1, and the default number of posts per page respectively.
    $keyword = isset($_GET['keyword']) ? $_GET['keyword'] : '';
    $category = isset($_GET['category']) ? $_GET['category'] : '';
    $page = isset($_GET['page']) ? $_GET['page'] : 1;
    $posts_per_page = isset($_GET['posts_per_page']) ? $_GET['posts_per_page'] : get_option('posts_per_page');

    // These lines construct arguments for the WP_Query object which will be used to fetch posts from the database.
    $args = array(
        'post_type' => array('post'), // Include both posts and pages
        'posts_per_page' => $posts_per_page, // Number of posts to display per page
        'paged' => $page, // Current page number
        's' => $keyword, // Search keyword
    );

    // Add category filter if a category is selected
    if (!empty($category)) {
        $args['tax_query'] = array(
            array(
                'taxonomy' => 'category', // Taxonomy to filter (in this case, category)
                'field'    => 'term_id', // Use term ID to filter
                'terms'    => $category, // The selected category ID
            ),
        );
    }

    // Perform the query to retrieve posts based on the provided arguments.
    $query = new WP_Query($args);

    // Check if posts were found
    if ($query->have_posts()) :
        // Loop through each post in the query result
        while ($query->have_posts()) : $query->the_post();
            // Display each post's title and excerpt
            echo '<div class="search-result">';
            echo '<h3><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>';
            echo '<small>' . get_the_excerpt() . '</small>';
            echo '</div>';
        endwhile;
    else :
        // If no posts were found, display 'No more posts'
        echo 'No more posts';
    endif;

    // Reset post data to ensure that global variables are restored to their original state after the query
    wp_reset_postdata();

    // Terminate the script execution
    die();
}



// Register shortcode
function custom_search_shortcode() {
    ob_start(); // Start output buffering
    ?>
    <div style="border: 2px solid #000; padding: 30px; ">
        <form role="search" method="get" class="search-form" id="custom-search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
            <label>
                <span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ); ?></span>
                <input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ); ?>" value="<?php echo get_search_query(); ?>" name="s" id="search-keyword"/>
            </label>

            <label>
                <?php
                $categories = get_categories();
                if ( $categories ) {
                    echo '<select name="category" id="search-category">';
                    echo '<option value="">Select Category</option>';
                    foreach ( $categories as $category ) {
                        echo '<option value="' . $category->term_id . '">' . $category->name . '</option>';
                    }
                    echo '</select>';
                }
                ?>
            </label>
        </form>
        <br />
    
        <div id="search-results"></div>
    	<button id="load-more-btn">Load More</button>
    </div>
    

    <script>
    jQuery(document).ready(function($) {
        var postsPerPage = 3; // Number of posts to load initially
        var currentPage = 1; // Current page
        var keyword = $('#search-keyword').val();
        var category = $('#search-category').val();

        // Function to load posts
        function loadPosts() {
            $.ajax({
                type: 'GET',
                url: '<?php echo esc_url( admin_url('admin-ajax.php') ); ?>',
                data: {
                    action: 'custom_filter_posts',
                    keyword: keyword,
                    category: category,
                    page: currentPage,
                    posts_per_page: postsPerPage
                },
                success: function(response) {
                    $('#search-results').append(response);
                }
            });
        }

        // Load initial posts
        loadPosts();

        // Load more posts when the button is clicked
        $('#load-more-btn').on('click', function() {
            currentPage++; // Increment current page
            loadPosts(); // Load more posts
        });

        // Trigger search when the keyword input changes
        $('#search-keyword').on('input', function() {
            keyword = $(this).val(); // Update keyword
            currentPage = 1; // Reset current page
            $('#search-results').empty(); // Clear existing results
            loadPosts(); // Load posts with updated keyword
        });

        // Trigger search when the category dropdown changes
        $('#search-category').on('change', function() {
            category = $(this).val(); // Update category
            currentPage = 1; // Reset current page
            $('#search-results').empty(); // Clear existing results
            loadPosts(); // Load posts with updated category
        });
    });
    </script>

    <?php
    return ob_get_clean(); // Return the buffered content and clean the buffer
}
add_shortcode('custom_search', 'custom_search_shortcode'); // Register the shortcode

Then on your page, add this shortcode [ custom_search ]

If you are familliar with PHP and WordPress, just read through the code comments and try to understand.

Bootstrap Tagsinput – Manually adding class on loop-added tags

Bootstrap Tagsinput plugin is awesome. It has great functionality and lots of methods and functionalities it can offer. For more info about it, visit https://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/

Let’s say you have this code.

<p><label for="npis">10 digit numbers</label><br />
<input type="text" id="num" name="npis" data-role="tagsinput" /><br />
<span class="v_error"> </span>
</p>

To initialize the Tagsinput plugin.

jQuery('input#num').tagsinput({
    tagClass: 'badge badge-default',
    maxChars: 10,
    trimValue: true,
});

Now, you want to check the input first before adding them as tags, let’s say numbers only and it should be 10 digit numbers separated by commas.

// event before add tag
jQuery('input').on('beforeItemAdd', function(event) {
    // event.item: contains the item
    // event.cancel: set to true to prevent the item getting added

    // check item if numbers only using regex
    var isNum = /^\d+$/.test(event.item);
    if(!isNum){
        jQuery('span.v_error').html("Enter multiple numbers separated by commas (e.g., 1234567890, 4567891231)");
        event.cancel = true;
    } else if(event.item.length !== 10){ // check if length of input is 10
        jQuery('span.v_error').html("Your numbers should be a 10-digit number.");
        event.cancel = true;
    } else {
        jQuery('span.v_error').html('');
    }
});

Now, what happens here is that, when you type in the keyboard, before the tags are created, it will detect first if there are letters or special characters in the input, if there are none and if the number input is equal to 10 digits, then the tag is created. Check the image below.

Bootstrap Tagsinput – Manually adding class on loop-added tags

Now the problem, you want to submit these numbers to an API, then the API checks what numbers are valid or not. Let us say, NPI numbers for doctors. Each doctor has a 10-digit NPI number. So the API checks in the server database which ones are valid or not, then responds back to the website browser which ones are valid/correct or invalid/incorrect. Now we want to display it to the user by highlighting the color, valid numbers are purple/lavender, just like the image above, and invalid NPIs are orange. Also you want to be able to still type in numbers in the input to resubmit.  In our case, by default, when a tag is created, I set the color to purple/lavender.

Here’s the solution.

First we need to create an empty array, this is where we will store the list of invalid numbers.

Check if there are invalid numbers by checking the length of the returned data array, then we iterate from there.

Then we use the add method from Tags Input to add the tags to the input box.

Then we push the invalid numbers to the empty array.

// create an empty array
let invalid_numbers = [];
// If number doesnt exist
// array_of_invalid_numbers will be an array of invalid numbers returned from the API
if(result_from_api.array_of_invalid_numbers.length){
    for (let i = 0; i <= result_from_api.array_of_invalid_numbers.length - 1; i++){
        // this is the Tagsinput method to add tags
        jQuery('input#num').tagsinput('add', result_from_api.array_of_invalid_numbers[i]);

        // we push the invalid numbers to the empty array invalid_numbers
        invalid_numbers.push(result_from_api.array_of_invalid_numbers[i]);
    }

    jQuery('span.invalid_error').html("Some numbers were not found in our database. Please remove or correct the numbers highlighted in orange.");
} else {
    jQuery('span.invalid_error').html('');
}

Then we get all tags added from the input box.

Then we loop through it using the jQuery function $.each().

Then we compare it to the invalid_numbers array.

Then remove or add classes.

// we get all tags by their class
// then we loop using the .each() function
// then we compare it to the invalid_numbers array
// if it matches then we remove the "badge-default" class and repalce it with "badge-invalid"
for(let inva_num = 0; inva_num < invalid_numbers.length; inva_num++){
    // this is the class generated to the tag inputs elements, check it in your browser console
    jQuery('.bootstrap-tagsinput span.tag').each(function(){
        if(jQuery(this).text() == invalid_numbers[inva_num])
        {
            jQuery(this).removeClass( "badge-default" ).addClass( "badge-invalid" );
        }
    });
}

The final result will be like this.

The orange ones are the invalid, and the purple one is the valid.

Why Saving Money is So Damn Hard

How much percentage do you save with your monthly income? 50% 70% 30%.

Most people save at least 20%, that is a good percentage for savings. While you spend 80% for things such as food, rent, mortgages(if you have mortgages, your savings can be lesser as mortgages tend to be higher cost) etc.

But sometimes you overspend. You overspend of food, on a date, on items and on many things.

For now I’m sure you know the difference between wants and needs. It’s basic. Basically, wants are things that you don’t need. You can survive without the “wants”. While needs are important. You need the need things in order to survive in your life and help you in your daily living, education and career. A high end expensive PC is not a want for video editors or game developers, it is a need. They need it for their career. While buying an expensive PC for gaming is first a need, and then a want. I don’t bash people for playing games, yes you need a high end PC for heavy gaming, but do you need to play games in life or is it just a want?

Overspending is the enemy of saving. We need to find the root cause of overspending, here it is, it’s very simple.

  1. You think you have enough money in your bank atm card.
    This is the most important thing to think about. When you have money in your atm card or wallet, you don’t worry about anything. You become careless. You purchase “WANTS” and not “NEEDS” You can buy an expensive dinner, or buy an item that amazes you without any worry in the world.You think “as long as I can retain that amount of money in my bank I can do what I want”.This is a problem. Many people are like this. Smart people do not leave money in their banks, they invest it. For them, it is better to use the money to buy an item that is a need rather than a money stuck in the bank.

    Money is meant to be circulated, not to be saved. This statement kind-of goes against the title of this article. But let me explain further.

  2. You don’t plan.
    This is is connected to #1.Simple. if you have plans in the future, then you’re a smart person. You save money for your plans. Whether this plans are buying need items or travelling, it’s good to have plans.Having money stuck in your bank plus you don’t have plans, equals disaster. When you plan, you plan it seriously. Whether you’re out for a walk, or a dinner date, your plans are stuck in your head. You are mindful of your expenses because all your money are saved for your plans. You wanna buy a car? buy a new laptop? It’s better to have a plan, this helps you save money for your goals.

    So next time you spend money for that expensive dinner? Stop. Stop being a mindless fool. Save money and spend it on your goals.

Real life experience.

One time I had 100,000 in my bank. Apparently, it retained for more than a year. It never went up. Sometimes I buy an item worth 10k, with 90k remaining. The next payday, its’ back to 100,000-ish. That’s one of my stupidest, lowliest, dumbest era of my life. I never saved money, I never had plans, I never spent that 100,000 for something good. I just went foolishly spending on things I want and never increased it. When you have money in the bank, and a relative or a close family member asks for money, you tend to give more. And families don’t repay. You could give away money because you think “because I have money” when in fact you’re slowly making yourself poor.

Then one day, I decided to buy a 100,000 worth PC. It is for my game development career. Then I realized suddenly it changed me. I suddenly became aware of my spending. All the useless expenses in my mind I suddenly regret or suddenly I didn’t want them anymore.

I became mindful suddenly. Before planning, I was thinking inviting my partner to a dinner, go out, grab some starbucks coffee, spend a minimum 1,000 in one day just for dinner. But after planning, I suddenly didn’t want to do that. See my point?

TIP

So for my tip, when you go out alone or on a date, remember your goals and plans, and make them a priority. think about it before going into a restaurants. This is also helpful when you’re stopped outside and is trapped by sales people, making you buy stuff you don’t really need. Better, when you’re trapped by scammers, and is trying to force you to purchase their stuff, just remember that you have a plan, a goal a priority, this will help you turn them down, say no. You will become a strong tower that cannot be torn down. When you’re outside, remember how much money you have in your bank, it can be a third, or half of the price of the thing you need to buy. Every cent counts.