Wow, that’s a long title! I had to do it though. I went crazy trying to find out how to do this and typed so many different things into google, only to find scattered information and crazy code everywhere.
In actuality the solution is quite simple.
Here’s some back story first so that it’s easier to understand exactly what I needed.
Laymans: I’m working on a website that will sell websites. Each website belongs to multiple categories. When someone clicks on a category, I want the website to only show the category that was clicked. So if you clicked business, the website would say it’s in the business category and so on.
WordPress Jive: I’m working on a website that will sell themes. Each theme belongs to multiple terms in a custom taxonomy. When someone clicks on a specific term, I want the theme to only display the term of the parent on the archive page. So if someone clicks Business, all the themes associated with the term Business will show up but will only display that they are part of the Business term, even if they are associated with other terms.
Got it. Good. Moving on…
Let me first say, I’m not a professional programmer. I’m a front end developer. I know CSS, HTML, some jQuery and a little bit of PHP. When it comes to getting deep into code with functions and arrays and what a function is returning, etc., it does not come easy.
In conjunction with that, wordpress has so many hooks and functions and filters, I have no idea which one to use! Check out the codex for get_terms. Now look at how many functions are related!!
Yeah, that’s what I went through.
I don’t remember where I found this solution but it was a mixture of different code that I eventually pieced together. Check it out:
This code will return the name of the parent term of the post that you’re in!
So how do you actually use this?
Well, I used this to replace the default Genesis Loop so that whenever someone clicked on the term link, it would display each post associated with that term. Each post would then display the term.
The code looked like this (I used the Agent Press theme to test it out):
Now, instead of showing a list of terms that the post is part of, it will only show the parent term of the page that it’s on!
If you know an easier way, or even just a different way, I’d love to hear it!
About the AuthorWhat's UP! This is my site, I write 99% of the articles on here. I'm also the owner of SureFireWebServices.com. I help out a lot of developers and designers getting into the web game. Helping is fun for me, so feel free to ask me any questions! I've made courses and have a membership as well to help get you on your feet!
You Might also like
By Jonathan Perez — 5 months ago
NOTE: GUEST POST 🙂 ENJOY
WordPress is a platform that is extensively used for creating blog websites. But have you ever thought of creating a website based on varied themes like fashion, beauty, lifestyle or any other subject of your choice? I guess you would have. Such a website that publishes content on a specific subject or a topic is termed as an online magazine. Having an online magazine that is fancy along with being sophisticated and contains appealing content will attract traffic to it. So, in this blog, I would be making you aware of the steps or techniques that you must implement in order to create a magazine-style website.
Below mentioned points will act as a perfect guide for you when you are looking to create your own online magazine with WordPress.
Having an Intriguing HomePage
It becomes utmost important to have a homepage that highlights the most popular and the recent stories along with displaying other articles. You must display multiple links and extracts from a selection of articles that you have published on your website. Your visitors must be presented with a few short stories and articles to choose from. Using a feature-rich magazine theme will enable you to build a homepage that has plenty of options which will attract visitors to your website. These themes have predefined homepages that are of different genre. This makes it very easy to choose a homepage for your magazine website and you could even find a homepage that fits in your website’s scenario. This will save a lot of your time which could have been invested a developing a homepage.
Top-Notch User Experience
Your online magazine will only become a success if it is able to generate traffic on it. It is important to keep your visitors as long as possible on your website. You will have to give your visitors such a visual appearance that will prompt them to visit your website again and again. This will enable you to create a long lasting impression on the minds of them. Most of the news websites and magazines display adverts which allow them to get monetized. Thus, the more page impressions that are generated by your visitors, you will be able to earn more money from your advertisers. This will only be possible will users choose your website over the others which searching for a particular content or topic.
Selecting a Magazine Theme
When you are looking to create a magazine website, you will come across quite a few of the magazine themes that are offered by WordPress for free. Some of the popular free WordPress magazine themes include Newspaper, Newsmag, TwentyFouteen and many more. You can even choose some of the premium WordPress themes that will offer you more functionalities and features but they will cost you money. The benefits of choosing an appropriate theme for your magazine website is that it will come preloaded based on some genre like lifestyle, heath and fitness, fashion etc. So, if your magazine content falls in the predefined category this will prove very beneficial for you. This will enable you to easily choose any of the themes based on your magazine requirements.
Creating Content for your Magazine Website
In order to create a successful magazine or news website, you will have to publish content that offers value to your target audience. The content you publish will totally depend on the focus of your website. A growth in the number of articles will have a direct impact on your visitors who will be directed to your website as a result of search engine results. Publishing relevant and informative articles will turn out positive for you. Choosing a content format that is appreciated by your audience will be a good ploy. A high-quality content will enable you to gets leads and also rank higher than the websites that are also showcasing a similar content as yours. Grabbing the attention of users is only possible if you rank higher in the search results of popular search engines like Google, Yahoo and Bing. Google also ranks a quality content much higher than the other contents of the same genre.
Growing Your Target Audience
Once you have got initial visitors on your website you will feel the need to grow your audience. The best approach of doing this is to pay for advertising on the social media platforms like Facebook, Twitter or seek assistance from advertising networks and platforms that are related to your topic. One thing which you must surely do is to set up profiles on the popular social media networks. There are some social media platforms that generate huge traffic on certain topics or subjects. Each and every social media platform has an audience of its own. You should also look for sponsorship opportunities, building partnerships with other people or even apply to guest post on related websites to get a link back to your website. Another important component in building your audience is to adopt a strategy while setting up your email newsletter. Persuading your visitors to sign up for your newsletter is a proven methodology to convert one-time visitors into loyal customers.
I hope that the above-mentioned points throw enough light on the parameter that you need to take care of if you want to create a successful online magazine. It would be great to have your views on this post of mine. Do let me know about them in the comments section below.
Sarah Clarke is working as a professionally qualified WordPress Developer at WordSuccor Ltd., a renowned firm providing WordPress Theme Customization Service at very reasonable cost with a global reach. She loves to share her thoughts on WordPress and always looking for learning something new about it. You can follow her company on various social media sites such as Google+, Facebook, and Twitter.Post Views: 135
By Jonathan Perez — 4 months ago
This is a situation that happens more often than not. Some awkward plugin conflict or server error happens and no one knows what the root cause is. How do you fix these issues? How do you even find out what is causing the error. I’ll go over a few ways to troubleshoot the problems and I even added a video that shows me troubleshooting an issue with one of my client’s sites. The funny thing is, depending on the problem, you may get a fake Eureka moment as I did in the vid.Watch on YouTube: http://www.youtube.com/watch?v=dcAwGGwNKVY
What type of conflict are you having?
When it comes to WordPress, I think most conflicts happen when a bunch of plugins are used, and no one audits to check out why or how they’re being used. Most end users, with no restraint, end up installing random plugins to accomplish something they need, but when they realize they don’t need them, they still leave them up.
Sometimes it’s the developer that just starts to install many different plugins that end up not playing nice together.
Besides the plugins that can cause conflict, there may also be theme issues. I had an issue at one point where the developer h
I had an issue at one point where the developer dequeued (or removed what was once there) jquery, and hard coded in a version from Google. This probably wouldn’t be a bad thing, except that jQuery is constantly updated, and the hard-coded version was very outdated, causing new plugins and functions to not work.
The first thing that you would need to do when troubleshooting is to try and figure out what the issue is. A simple way to do that is to check the Developer Console.
I use Chrome and to see what issues may be happening, all you have to do is right-click an area, then select “Inspect”. After you do that, click on the tab called ‘Console’ to see if any errors pop up. Errors will be in red.
Once you do that, you’ll get a better insight on what may be causing the issue.
When there is a conflict, you can move your mouse over the file name to see where the issue is coming from. It’s usually a file, and moving your mouse over it will show the path. If it’s not a file and it just says (index), then that means the error is directly on the page.
If it’s directly on the page, then you’ll need to see what plugin or what area of your site gives access to create code on the page as opposed to in its own file.
In my case, I was trying to find a server error 500.
This has to do almost entirely with your hosting company. Keyword almost. A server 500 error really doesn’t mean anything and most times it’s only temporary, but in my case, it was something that kept happening.
It could be a memory thing, a ram thing, something being updated, it’s a very general error and you’re best bet would be to contact your hosting company.
That’s what I did, and they made some changes which temporarily fixed a few things, but the issue would keep coming back. That led me to believe that it had to be something else.
And that is where the site troubleshooting to fix the error starts.
Steps to Troubleshooting Your WordPress Website
Step 1: Back Up Your Website
You’ll need to make sure that you have a full backup of your website in case anything goes wrong. You don’t want to be stuck trying to retrace your steps and you NEVER want to work on a live site. Back up your website and prepare for a migration.
I use UpDraft Plus and it works like a charm. You can also use BackUp Buddy or whatever backup software you’re comfortable with. Just know that you’re backing it up, and you’ll be copying it to a test server.
Step 2: Migrate the site
I like to put the site in a staging environment, sometimes on my local machine, but most of the time on my own host. I use my own host and a subdomain because it’s easier for me to replicate the issue since it’s on the same exact environment as the website.
Restore the site exactly how it is on the server and start to troubleshoot.
Little side note: Depending on the issue, the main thing you want carried across are the database, the themes, and the plugins. The media is good too if it’s something visual, but sometimes the media folder can be gigabytes of data. So in the spirit of saving time, you don’t need the entire uploads folder all the time.
Step 3: Start with plugins
Before you go and disable every single plugin, keep in mind that there’s a method to the madness. What I like to do is look for the known culprits first, then work backward from there.
A lot of times, the issue can come from caching plugins because of minifying and uncleared cache, so that’s what I look for first. I’ll disable it, then try again and see if it works. Usually that fixes most issues, but it may not, so we continue to move forward.
BTW, My main choice of caching plugins for WordPress is WP-Rocket.
After I disable the caching plugins, I then look to see what kind of plugins are there that aren’t a part of the core functionality of the website. For example, a display author plugin, or a plugin that just does something that the user can live without.
Keeping track of what I’m removing, I disable them one by one, checking to see if it fixed the issue, then go back.
It’s a long, tedious process, but with a little bit of luck, you may find the culprit pretty quickly.
Once you do all the unecessary plugins, now it’s time to start the core functionality plugins. These are the bad boys that run the site. WooCommerce, plus extensions, maybe EDD, or other plugins that the client needs in order to do business or make the site function.
Wash, rinse, repeat.
Step 4: Still Broken!?
What a pain lol. The simplest thing to do now is to reactivate the plugins, and switch out the theme. Use one of WordPress’s generic ones, like 2017 or 2016.
By now, the issue should be resolved and you should have found what was causing the bug with your WordPress website.
How To Avoid Issues for the Long Term with WordPress
If you’re a developer or if you’re someone who has a website, this is definitely something to keep in mind. I found that the best way to avoid issues is consistency.
The Bad Thing
Here’s what a LOT of developers do when someone needs a website. They go onto a theme site, they pick a theme that the client may like (thinking that this is saving them money). The developer then hacks away to get that “theme” to look how the client wants it.
They flood it with plugins to get the right “functionality” even for basic things like simple style changes.
Then they deliver exactly what the client wants, but the build is horribly done, leaving no room for growth or updates. Changes are much more complicated to accomplish costing more and more money for the end user. So they money they think they saved, ends up getting spent on fixes and updates, and sometimes the site has to get a complete rehaul.
Of course, no one likes to here that they wasted a few thousand dollars, but that’s where we are today. The good thing is there are tools that make creating websites super easy, but the way in which sites are built is being taken for granted.
The Good Thing
The ulimate dev stack. This is my suite of tools that I use to build every site I work on. As I said, consistency is key. If you know your tools inside out, you’ll know exactly what works and what doesn’t work, what you can use and what you can’t use, where you can put the website and where you can’t put the website. You get the point.
If you’re a developer, you should definitely check out that dev stack. If you’re an end user, what you really need to focus on is someone who is going to build a site that will be as flexible as your business. Something you can grow with. A consistent set of tools is KEY to avoid so many issues that happen on SO many websites. Otherwise you may be spending a lot more money in the long run, or continue to hack away digging the ditch deeper and deeper.Post Views: 84