Showing posts with label Blog. Show all posts
Showing posts with label Blog. Show all posts

Wednesday, August 17, 2016

How to Exclude a Post or Page from WordPress Search Results

I needed to have one post in a site I’m building not appear in search results. I came across this handy bit of code that totally does the trick, and it works for a page, too:

/** Exclude from search */
function mySearchFilter($query) {
if ($query->is_search) {
$excludeId = 199;
$query->set('post__not_in', array($excludeId));
}
return $query;
}
add_filter('pre_get_posts','mySearchFilter');

Copy and paste the above code in your theme’s Functions file:

Dashboard > Appearance > Themes > Editor > Functions.php

Then, replace “199” in this example with the ID of the page or post you want excluded. To find the ID, edit the page or post in the dashboard and look for this number:

postnumber

You might need to access the Functions.php file in your themes folder via FTP if you have a custom install.

This right here is one of the main reasons I love WordPress. Because it’s open source and so widely-adopted, chances are there’s a solution for whatever basic issue may arise. To find this result I just Googled, “How to exclude page in WordPress search” and was taken to this support discussion from several years ago. Even though it’s from a previous decade, the advice still worked, and I hope it might help you also.

What do you think? Have you ever been led to WordPress forums via Google search for a how-to type of question? How do you prefer to find answers to these issues? Let us hear from you in the comments.

Saturday, January 19, 2013

For When You Don’t Feel Like Blogging


Writing a blog post shouldn’t be a big deal, especially if you’re serious about blogging. That said, there are going to be days when you just don’t feel like it.
Blogging
Check out the full series of blogging-themed images
I created over at Flickr and feel free to use them on your own blog.
Having done this for over a year now, a couple times per week steadily, I can fully attest to the occasional lack of motivation – but I always fight through and deliver the goods. Along the way, I’ve picked up these tips for those dark moments when you might not feel like keeping up with your own blog.

1. Have some posts in the bank

In those spells when you feel like writing, or when an idea hits, try to go with it. Take two minutes to get your thoughts into a few sentences or headings you can easily expand upon later. I’ve found the best tool for doing this is dictation software, or at the very least, the drafts feature in WordPress. I’ll even email some ideas to myself as a way of quickly capturing a subject or notion I know can be expanded upon down the road. That way, when the time is right, the content is ready to go.
Language Is A Virus
Another great site for
writing inspiration:LanguageIsAVirus.com

2. Know your inspiration

Have some role models or examples of sites you enjoy on hand to get you thinking about material for your own blog. Or, as Janet Aronica aptly states over at Shareaholic (among the many other excellent tips there):

“Consume the content you want to create.”

By being able to easily refer to your sources of inspiration, you’ll be more likely to generate your own material with your unique perspective – which is the very best part of having your own blog. Set up some bookmarks, feeds, subscriptions, or whatever aggregation method works best for you so you can get inspired and have your own creative juices flowing.

3. Keep it simple, genius

A blog post does not have to be 10,000 words, nor should it be. In fact, brief is often better. I’ve found some of my most popular posts are sometimes the ones with just a compelling image and only a few sentences. Being handy with the phone cam and always on the lookout for quality visuals to share is something I enjoy, and also something I recommend for having interesting blog fodder at the ready.
What do you think? Are these suggestions useful? What tips would you suggest for drumming up motivation or inspiration in blogging? Let us hear from you in the comments.

Friday, November 23, 2012

Blogchat: Sundays on Twitter


There’s one thing I’ve really gotten into the social media realm lately: Blogchat. This is a chat on Twitter where folks talk, er… tweet, about blogging-related topics.
Blogchat - Sundays at 9:00 p.m. EST on Twitter.
Graphic by me via iPhone, using Hipstamatic & Phonto
I’ve made so many connections there, garnered blogging tips, and become more adept at Twitter by taking part. I highly recommend it to anyone interested in getting more from blogging (as a blog reader, I assume you may have an interest). Once, I even helped suggest a topic for an upcoming chat:
To participate, follow the hashtag #blogchat on Twitter, stay on topic, and keep hitting “refresh” on whatever means you use to keep up with the conversations. It’s fast-moving, so using a tool like TweetChat or HootSuite with multiple columns or tabs can be very helpful, although I’ve navigated it successfully just by using Twitter from the browser, or even by iPhone. It’s led by Mack Collier and happens every Sunday at 9:00 p.m., U.S. Eastern standard time. Recently covered topics include time management for bloggers, copyright issues, and using images.
There’s also a monthly open mic for non-specific blogging-related topics. Even if you don’t specifically participate 0r prefer just to listen in, that’s totally fine. You’ll probably still pick up a tip or two, and it’s a good way to see how the conversations flow.
Participating has encouraged me to explore other Twitter chats, and I’ve found them consistently beneficial, especially given the breadth of perspectives from some experienced and friendly folks. Try it sometime – and have fun chatting.
What do you think? Have you ever participated in a Twitter chat? What are some other resources you recommend for blogging advice and ideas? Let us hear from you in the comments.