Just a heads up to those out their in blogland who, like me, use Blix by Sebastian Schmieg as their WordPress theme.
The upcoming version 2.1 has made some change which mess up Blix’s handling of its navigation bar. The fix is simple and I post it here to allay anyone’s nerves who begin to panic when their pages seem to disappear.
In the Blix theme folder there’s a file called BX_functions.php and somwhere about halfway through is a function BX_get_pages…
function BX_get_pages($with_content = '')
{
global $wpdb;
$query = "SELECT ID, post_title, post_name FROM " . $wpdb->posts . " WHERE post_status='static' ORDER BY menu_order ASC";
if ($with_content == "with_content") {
$query = "SELECT ID, post_title,post_name, post_content FROM " . $wpdb->posts . " WHERE post_status='static' ORDER BY menu_order ASC";
}
return $wpdb->get_results($query);
}
When you eventually upgrade to WordPress 2.1 you will need to make two small changes to this function. Find the text WHERE post_status='static'
, which occurs twice, and change it to WHERE post_type='page'
. That’s all there is to it.
Can you suggest me a conditional method so that Blix theme works with both 2.1 and 2.0.x series as well. because this modification will mess the header in 2.0.x series!
Navjot Singh: You can use:
Instead of duplicating so much codes…I used this
function BX_get_pages($with_content = ”)
{
global $wpdb;
$query = “SELECT ID, post_title, post_name FROM ” . $wpdb->posts . ” WHERE post_type=’page’ OR post_status=’static’ ORDER BY menu_order ASC”;
if ($with_content == “with_content”) {
$query = “SELECT ID, post_title,post_name, post_content FROM ” . $wpdb->posts . ” WHERE post_type=’page’ OR post_status=’static’ ORDER BY menu_order ASC”;
}
return $wpdb->get_results($query);
}
Now it works!
Thank you, this solved my problem 🙂
Great! I’ve been looking for this fix with Blix the whole day! Now I need to figure out how to fix my link problem then i’m ready for an upgrade 🙂
Glad it’s helping… I found another blip in Blix last night which you might want to also fix. The BX_archive function (in BX_function.php) needs its two queries modified so that it doesn’t include pages in the archive listing. An extra
"AND post_type='post'"
in both places does the trick.Thanks! you saved my day!
got a small problem though… my pages- links, about and archives appear in the recent posts as well as archives main page…
how can i remove them?
yuvach: Same principle… the BX_get_recent_posts fucntion has a query … change
… WHERE post_status=’publish’ …
to
… WHERE post_status=’publish’ AND post_type=’post’ …
I don’t use this part of Blix so I hadn’t thought to check it.
Good luck!
It worked!!
Thanks a ton!
thanks!!
If you only want to correct the navigation bar, you can use much simpler code in WP 2.0 and 2.1, as WordPress now has its own function for listing pages. Just remove the usage of BX-functions from header.php and use the WP function instead.
See http://wordpress.org/support/topic/101812?replies=13#post-506687 for the code.
Darius: I agree that I’d prefer to use WordPress’s own functions which are “less” likely to stop working if internals are changed … however the solution presented at your link to WP support seems at first glance to miss out the translation of the about page title etc.
The Blix solution isn’t very elegant but it would take rather more surgery to replace it.
thank you thank thank you!!!
jase, affy, et al.: it’s a pleasure … I like the look of Blix and really didn’t want to abandon the investment I’d made in adapting it to my needs.
The fix doesn’t seem to work with the current version of wordpress…
However, modifying the query like this works:
WHERE post_status=’static’ OR post_status=’page’ ORDER BY menu_order ASC
Sorry…I posted the wrong code in the previous comment. It should be:
WHERE post_status=’publish’ AND post_type=’page’
Jacob: You’re right that since WP 2.1 allows draft pages you probably want to exclude them.
Your fix got my entire site to come back up as it kept saying nothing was there, but my pages are still missing in the navigation bar. Could someone please take a look at http://bamforbeginners.com and give me a hint? I’m going nuts!
Sean: Just looking at the site doesn’t really help. Maybe you could send me a copy of your BX_get_pages fucntion in BX_functions.php and I could have a look?
Hi People,
I released a blix based theme about 2 months ago called BlixKrieg – it drops right over an existing Blix Theme, and is also WordPress 2.1 (and backwards) compatible – It also enables you to include google adsense ads if you want them (and allows you to easily configure what type of ads you display, and if you want to display them, from one simple to use config file) – if you’d like to download it, it is free – Download BlixKrieg From UtheGuru.com
Perfekte, besten Dank für die Lösung!
Used your contact form, hope that helps!
To Basti – Meine Deutsch ist nicht so gut:-
nicht ein Problem, bin ich du bin erfüllt sehr glücklich!
Danke,
TheDuckman
The BlixKrieg theme is, how hould we say it, well proven, but the 2.1 compat changes are still one step after beta – whatever that is 🙂 Just feel free to post on my blog if you have any probs – I’m pretty into blix, so it’s likely I’ll get you an answer and an update to any of your probs pretty quickly… Any and all code suggestions are appreciated.
Also, anyone that wants to help me rewrite the ReadMe (from a newbie perspective) will be welcomed with open arms 🙂
Thanks!
TheDuck
Thanks for the updates!
Hey great fix for some of this issues related to the Blix Theme. I hope you might be able to help me out!
It maybe something silly but where my blogroll list would be I’ve re-named it Friend’s Sites instead. However for some unknown reason it has created the Friend’s Sites link under Categories, which I didn’t want any clue how to get rid of this under Categories?
Cheers!
Donna: I’m not sure … but is this anything to do with WP2.1 merging the links and categories into one table? Link categories are displayed as well as post categories when you list them all. I’ve used
hide_empty=1
in thewp_list_cats
call to only show categories which have posts. I suspect that is a hack and 2.1 has some new template tags for handling, e.g. wp_list_categories.I have no clue, but it appears to be working now…I have no clue any more, but, eh…and it was your code that did it! Thank you!
Hi Rob / Donna,
if you find out for sure, could you please let me know and I’ll add the fixes to my theme over at utheguru.
Cheers
TheDuck
Hey Rob, that seems to have worked a treat! How unusual of it to have done that but great thank you. It never occurred to me to change that value.
Hi Everyone, I’ve incorporated Rob’s suggested fix for Donna’s problem in the Blix Krieg theme I mentioned above. Thankyou Rob for providing the fix.
TheDuck
Hi Guys, noticed another similar problem to the previous post I added. Although it solved hiding Friend’s Sites from under categories on the front page.
Whenever you go into a post to read it I notice it appears in the Posts by Category section. Any ideas how to hide it away in this section also?
Cheers
Hey, i just applied the same method to the post categories hide_empty=1 and it worked!
why My index.php can not display the Previous Posts link and Next Posts link.
I use the blix and wp2.1 too!
yet: If you look in Blix’s index.php you’ll find a commented bit of code that does just this — all I did was remove the comments to make it active.
I used this fix, and it fixed that problem, but not the problem i was trying to solve lol
for some reason, my navigation bar is extended in height.
does anyone know why?
http://www.musicleech.com/blog
thanks!
This post saved mye life, as I’m tweaking the theme ‘orangescale laila butterfly-1.0’ which has the same problem with WordPress 2.1 as Blix.
Thanks for posting this info – and God save the blogs 🙂
I fixed my problem
the thread on the sitepoint forums can be seen here
http://www.sitepoint.com/forums/showthread.php?p=3289727#post3289727
Thank you very much, you saved my day!!!
sorry for the dumb question but I’m glad I found this page and the help for the Blix theme and wondered if you could help a newbie out… how do you uncomment php???
thanks,
Mark
Mark: PHP has several ways to put comments into code. A single line can be made into a comment by putting // at the start of the line. Longer comments can be marked out by sandwiching them between /* and */.
Ordinarily comments are meant to do just that, comment on the code, but sometimes you want to take a piece of php code and stop it being processed. You could delete it but you might want to put it back at some future date. What you can do is turn the code into a comment. That way the php interpreter ignores it.
To uncomment some php code all you have to do is remove the characters that mark it as a comment — delete the // or the /* and */
That sounds convoluted but its easier to do than it is to describe. Good luck.
Rob, thanks a lot for the info – I knew the premise of commenting code but your post really helps me a lot. Your blog seems to have a lot of things going on in the sidebar that I can’ seem to activate, such as recommended readings and most recent posts. Are these commented out of the Blix theme and if so do you know which pages, or where on the sidebar page I should be looking. Or, are these add-ons that either you created or are they plugins?
thanks again, Mark
hey Rob,
disregard that last post, all I had to do was look at your plugin page. Many thanks again!
peace, Mark
ok last post I promise. what code is necessary to turn on the green CSS title bar for most recent comments? It shows up on the category and permalink pages but not the front page?
many thanks, mark
Mark: Hi! Thanks for the flurry of comments. It’s nice that answer your own questions too 😉
I followed the example that was already there in the Blix sidebar.php and marked up like this:
<h2><em>Most Recent Comments</em></h2>
That’s all inside a
<div id="subcontent">
though.Does that help?
This solved my problem. Thanks a million!
Thank you for the fix!
gracias por el fix, merci, thanks
lost format of the buttom but will look somewhere else?
Y
Hey, that worked! I was worried for a minute after updating. Thanks.
I’ve just inherited maintenance of a wordpress site; I’ve used other CMSs but am a WP newbie.
The Blix theme seems to only support 7 tabs – is that true? The 8th tab is essentiallly invisible, becoming what acts like a drop-down to the first tab.
Is there an easy way to fix this, or is it more a matter of my getting a clue somewhere 😕