1 afwas Apr 11, 2008 23:40
3 afwas Apr 12, 2008 23:10
'This is not a bug' fix:
Crack open /inc/items/model/_itemlist.class.php and add line 582 in this context:
581 case 'title':
582 case 'ptyp_ID': // Add this line
583 case 'datecreated':
584 case 'datemodified':
585 case 'urltitle':
586 case 'priority':
4 mochababy Apr 14, 2008 01:00
Afwas wrote:
'This is not a bug' fix:
Crack open /inc/items/model/_itemlist.class.php and add line 582 in this context:
581 case 'title': 582 case 'ptyp_ID': // Add this line 583 case 'datecreated': 584 case 'datemodified': 585 case 'urltitle': 586 case 'priority':
ok so i added that post type and all, it works....i love it! I now need to figure out how i could possible change the title bg of any posts with that id to red so people can distinguish them from the rest
5 afwas Apr 14, 2008 01:45
Hi mochababy,
That's a nice idea.
Open the main page of your skin, most likely index.main.php in aome skins posts.main.php and find the post title:
<h2 class="evo_post_title"><?php $Item->title(); ?></h2>
Change that to:
<?php
if ( $Item->ptyp_ID == "5001" )
{
?>
<h2 class="evo_post_title evo_post_title_red"><?php $Item->title() ?></h2>
<?php
}
else
{
?>
<h2 class="evo_post_title"><?php $Item->title(); ?> - normal</h2>
<?php
}
?>
My type ID for the sticky post actually is 5001. This may be different with yours.
In the corresponding stylesheet add after .evo_post_title:
h2.evo_post_title_red a {
color: red;
}
Names may differ slightly with skins.
Good luck
6 edb Apr 14, 2008 02:33
Would this work just as well and facilitate other p_types getting the royal treatment?
<h2 class="evo_post_title <?php echo $Item->ptyp_ID; ?>"><?php $Item->title() ?></h2>
Then you have to make a style statement for .5001 or whatever ptyp_ID you want to decorate of course. Dunno why one might want that but hey if you have reason for stuff beyond the popular "sticky" and the included "page" you might want to have a way to highlight it.
7 afwas Apr 14, 2008 02:38
Thanks EdB,
Your solution is a lot easier to apply. That's enough reason to favor it.
8 edb Apr 14, 2008 06:02
um... is there a stylesheet rule that says classes can't have numbers in them? I was just playing with this figuring on adding a wee bit of border-left to the post title based on ptyp_ID but it didn't work until I turned "5002" into "fiveohohtwo" BUT I didn't really do it via stylesheet: I cheated and used the webdeveloper toolbar "edit css" feature. I know that in many cases it makes a stylesheet go weird so I figured I would ask if there is a stylesheet rule before actually trying it by uploading a style sheet change.
9 edb Apr 14, 2008 06:17
Okay never mind. I just found a page that tells me I can't START the class name with a number, and my favorite stylesheet editor seems to agree. Therefore this is what I am using now:
<h2 class="n<?php echo $Item->ptyp_ID; ?>">';<?php $Item->title( array( 'link_type' => 'linkto_url' ) ); ?></h2>
Clearly in my stylesheet I have to know that I put a letter "n" before the post type number yah? So like
.n5001 {
border-left: 48px solid black-with-whitish-streaks-in-it-so-it-looks-sort-of-like-marble;
}
10 sims Apr 14, 2008 09:07
When trying to install the plugin on my 2.4.1 install I get this folowwing message
Fatal error: Call to a member function get_by_name() on a non-object in /home/barntcou/public_html/plugins/stickyannouncements_plugin/_stickyannouncements.plugin.php on line 144
Line 144 is:
return $ItemTypeCache->get_by_name( $fullname, false, false );
Any ideas what could be wrong?
11 edb Apr 14, 2008 12:57
There is no plugin for this feature in v2.*. Instead you create a new post type (global settings tab, post types subtab), then make your "sticky" post be that post type, then do the "orderby" thing that Afwas describes at the top of this thread, then do the "not a bug fix" for the non-bug bug that Afwas describes next.
12 mochababy Apr 14, 2008 20:39
EdB wrote:
Okay never mind. I just found a page that tells me I can't START the class name with a number, and my favorite stylesheet editor seems to agree. Therefore this is what I am using now:
<h2 class="n<?php echo $Item->ptyp_ID; ?>">';<?php $Item->title( array( 'link_type' => 'linkto_url' ) ); ?></h2>
Clearly in my stylesheet I have to know that I put a letter "n" before the post type number yah? So like.n5001 { border-left: 48px solid black-with-whitish-streaks-in-it-so-it-looks-sort-of-like-marble; }
i like your solution! Just as the world turns...i have another issue i need to resolve with this. When this method is applied it makes the sorting function now part of title as if the filtering is user inspired.... :( so now i will have to find a way to get around that. Its not that i'm crazy neurotic its that my google things will be screwed up if i add another parameter to the long urls i already have. I'm sure you guys that practice SEO know what i'm talking about!
Any ideas let me know!
13 sims Apr 14, 2008 20:56
oh right, that would explain it. I really should read all pages when catching up on posts that I havent been following. I missed the subtle difference between plugin and hack.
Anyway I have made the changes and despite this area being in a slightly different place all seems to be working fine.
"Crack open /inc/items/model/_itemlist.class.php and add line 582 in this context: "
Thank you for your help.
14 sims Apr 14, 2008 22:40
A silly question (if you don't already know the answer):
I have my css classes working on the title with this code:
<h3 class="n<?php echo $Item->ptyp_ID; ?>"><?php $Item->title() ?></h3>
I just wondered what the extra bits on your code do and if I could benefit from them EdB?
<h2 class="n<?php echo $Item->ptyp_ID; ?>">';<?php $Item->title( array( 'link_type' => 'linkto_url' ) ); ?></h2>
15 sims Apr 14, 2008 23:52
mochababy wrote:
EdB wrote:
Okay never mind. I just found a page that tells me I can't START the class name with a number, and my favorite stylesheet editor seems to agree. Therefore this is what I am using now:
<h2 class="n<?php echo $Item->ptyp_ID; ?>">';<?php $Item->title( array( 'link_type' => 'linkto_url' ) ); ?></h2>
Clearly in my stylesheet I have to know that I put a letter "n" before the post type number yah? So like.n5001 { border-left: 48px solid black-with-whitish-streaks-in-it-so-it-looks-sort-of-like-marble; }
i like your solution! Just as the world turns...i have another issue i need to resolve with this. When this method is applied it makes the sorting function now part of title as if the filtering is user inspired.... :( so now i will have to find a way to get around that. Its not that i'm crazy neurotic its that my google things will be screwed up if i add another parameter to the long urls i already have. I'm sure you guys that practice SEO know what i'm talking about!
Any ideas let me know!
Same here, I can't quite work out how it is being ordered but it is not alphabetically or by date.
EDIT: Being thick, it's obviously being sorted by the post type and then the modified date.
I'm going to change this to post type then date created, should fix it?
16 mochababy Apr 15, 2008 00:43
sims wrote:
mochababy wrote:
EdB wrote:
Okay never mind. I just found a page that tells me I can't START the class name with a number, and my favorite stylesheet editor seems to agree. Therefore this is what I am using now:
<h2 class="n<?php echo $Item->ptyp_ID; ?>">';<?php $Item->title( array( 'link_type' => 'linkto_url' ) ); ?></h2>
Clearly in my stylesheet I have to know that I put a letter "n" before the post type number yah? So like.n5001 { border-left: 48px solid black-with-whitish-streaks-in-it-so-it-looks-sort-of-like-marble; }
i like your solution! Just as the world turns...i have another issue i need to resolve with this. When this method is applied it makes the sorting function now part of title as if the filtering is user inspired.... :( so now i will have to find a way to get around that. Its not that i'm crazy neurotic its that my google things will be screwed up if i add another parameter to the long urls i already have. I'm sure you guys that practice SEO know what i'm talking about!
Any ideas let me know!
Same here, I can't quite work out how it is being ordered but it is not alphabetically or by date.
EDIT: Being thick, it's obviously being sorted by the post type and then the modified date.
I'm going to change this to post type then date created, should fix it?
yes, it does sort as it professes to do...but it also gives you a longer url where the filtering method is revealed (ie. different urls that what google crawled before)
17 sims Apr 15, 2008 00:55
I can't see any changes in the urls at all and can't understand how they would alter after adding this feature. How are you examining your urls?
Could you give an example?
P.S when I said "being thick" I was reffering to myself and not you. - just for the record.
18 edb Apr 15, 2008 01:54
"sims" wrote:
... I just wondered what the extra bits on your code do and if I could benefit from them EdB?
<h2><?php $Item->title( array( 'link_type' = > 'linkto_url' ) ); ?></h2>
Long story. So b2evolution likes to link the title to the permalink, but I don't. I think it's stupid - especially when you have a "link to URL" like you would do with a post in your linkblog. Instead it likes to put "Link: link-to-url-field-content" in the top of your post, which I find ugly beyond measure. Okay no problem: there is a back office setting that will let you go back to linking a post title to whatever you have in your "link to URL" field. The problem with using it is that the ministats plugin won't link to posts if you have that set the way I wanted to set it. *sigh* Rather than hack the ministats plugin I figured I would set the back office setting back to the default value of "title links to permalink" and force MY title links to "link to URL" field via a parameter you can feed the title. Which I then inadvertently pasted here.
By the way I had to hack the ministats plugin anyway :-/
19 sims Apr 15, 2008 02:20
Great explanation (as always) thank you.
Sounds like you have been having fun and games. So is that the only thing you need to add to accomplish your mission or is there more to it?
Just out of curiosity at the moment but you never know when the info might come in handy.
20 mochababy Apr 15, 2008 06:12
sims wrote:
I can't see any changes in the urls at all and can't understand how they would alter after adding this feature. How are you examining your urls?
Could you give an example?
P.S when I said "being thick" I was reffering to myself and not you. - just for the record.
oh no...its nothing...i was just trying to make myself clear i kno sometimes i can take a very long time to say something very simple and i can really mess it up! Thanks for responding...i see a change when i click the blog next buttons try it...it will show the method as though its a filter
Example:
http://www.barnesnet.co.uk/?blog=1&orderby=ptyp_ID%20datecreated&paged=2
instead of url/?blog=1&page=2
21 radminz6060 Jan 06, 2009 23:47
mochababy wrote:
Afwas wrote:
'This is not a bug' fix:
Crack open /inc/items/model/_itemlist.class.php and add line 582 in this context:
581 case 'title': 582 case 'ptyp_ID': // Add this line 583 case 'datecreated': 584 case 'datemodified': 585 case 'urltitle': 586 case 'priority':
ok so i added that post type and all, it works....i love it! I now need to figure out how i could possible change the title bg of any posts with that id to red so people can distinguish them from the rest
:oops: Has anyone come across this error after applying the recommended fix? Or better yet, does anyone know how to fix this error? Please explain cafefully = not a php programmer = but I can follow directions... any help = greatly appreciated, thanks: "K"
error = Warning: Cannot modify header information - headers already sent by (output started at /home/rcro/public_html/automotiveblog/inc/items/model/_itemlist.class.php:1251) in /home/rcro/public_html/automotiveblog/inc/skins/_skin.funcs.php on line 379
22 martha Jan 15, 2009 07:32
I created stickies and then had the same problem, and Afwas' "add line 582" fix cured it. (Thanks Afwas!)
Seems like it would be good for a non-hack sticky option to be included, whether as core or proper plugin...
23 radminz6060 Jan 15, 2009 16:54
I applied this fix and IE7 went south on me giving a blank warning page script error - while Firefox was able to retain the data and return a page, it also returned this error across the top of all of my blog pages....
here's the error again:
error = Warning: Cannot modify header information - headers already sent by (output started at /home/rcro/public_html/automotiveblog/inc/items/model/_itemlist.class.php:1251) in /home/rcro/public_html/automotiveblog/inc/skins/_skin.funcs.php on line 379
24 martha Jan 15, 2009 17:13
My Firefox 3.0.5/Mac displays fine. My newest IE is IE 5.2/Mac--that's the terminal version for the Mac (!!!)--and again page displays fine.
I need to get myself to a Windows machine and see what's going on!
--------(just a little later, no Windows machine check yet-----
I take that back--it was just that I wasn't getting an error message.
Safari 3.1.2 and Firefox 3.0.5 both FUNCTION fine as well as not returning error message.
Netscape 7.2 and Explorer 5.2--both ancient & kept for testing purposes--do not offer "leave a comment" on the sticky post (tho comments on for it) AND while they do offer that message on OTHER posts, they TAKE YOU to a single page that says "comments are closed for this post" (which they are not).
I'm running two installations of b2evo (each a single topic with top-level organization by multiple blogs), and the one I have NOT enabled for sticky posts FUNCTIONS correctly in N7.2 and IE5.2. So it is not just the damn non-compliant and/or ancient browsers....
Waiting a day or two to see if there is any communal wisdom out there before undoing the sticky hack (and its fix) and resigning self to life without stickies....
I moved this from bugs to hacks. If you hack b2evo and you break it as a result, you can't call that a bug.