Forum Replies Created

Viewing 15 replies - 46 through 60 (of 69 total)
  • In 2.1 I’ve hacked the classes.php to not only display the page_item class, but also my page slugs as a class for all links. IMHO that should be standard. Read my post on this: http://wordpress.org/support/topic/104396?replies=2
    Except I changed the id for class just because of an ID clash as I describe in the post…

    Sorry I don’t understand. Can you explain again?
    /T

    Thread Starter Tdude

    (@tdude)

    Ok. Thanx for the hint. I just downloaded 2.11
    Thank you everyone who contributed to this fix!
    /T

    Well, the answers for your first post are
    1.yes
    2.conditional yes/no*
    3.yes
    4.no

    1. It’s fairly easy to set up different categories and different styles to them in WP. It’s really up to you how you want your content. You have to read up on that in the codex.wordpress.com

    2.*I’m not sure about the user, but you could have
    “your name”
    “Your Name”
    “YOUR NAME”
    etc

    3.No problems. Create a page for each category or simply put something like this in your header.php:

    ‘<?php if ( in_category(‘3’) ){ ?>
    <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/style-one.css” type=”text/css” media=”screen” />
    <?php } elseif ( in_category(‘4’) ) { ?>
    <link rel=”stylesheet” href=”<?php bloginfo(‘stylesheet_directory’); ?>/style-two.css” type=”text/css” media=”screen” />
    <?php } ?>’

    I was new to WP a few months ago too 😉

    Well, in users/your profile, check “Use the visual editor when writing” for a start to see the WYSIWYG editor. Your problem with quicktags could be an error in a broken/hacked file, javascript turned off in your browser or just anything else. Could you describe it better?

    Not bad!
    Maybe more icons instead of repeating headers and such would increase legibility. A tighter…err, narrower, main column would be easier for the eyes to follow. That’s 2 things 😉

    This is a site I would like to come back to and hopefully many with me, hence the thoughts about icons.
    /T

    Oh. I have another hack for 2.07. If you need that, let me know.
    /T

    Hi there! I did that for one of my wp projects. I use the “page slug” parameter to get an id for each link to replace it in css with an image. There might be a better way and it includes hacking a few lines of php, but so far it hasn’t caused any errors that I know of.
    If you’re interested you could do the following:
    In WP 2.1 Open wp-includes/classes.php

    Around line 503 you will find the function start_el

    at that very line, add the parameter $post_name

    Then a few lines down where it says
    “$output .= $indent . ‘<li class=”‘ . $css_class . ‘”>”
    you need to add your new page slug paramter $page_name in an id or class tag to control it via css. Most of the time I hide the original text with a span tag to make it search friendly, but that’s up to you of course.

    The whole start element function looks like this in my file from line 503:

    function start_el($output, $page, $depth, $current_page, $args, $post_name) {
    		if ( $depth )
    			$indent = str_repeat("t", $depth);
    		extract($args);
    
    		$css_class = 'page_item';
    
    		$_current_page = get_page( $current_page );
    		if ( $page->ID == $current_page )
    			$css_class .= ' current_page_item';
    		elseif ( $_current_page && $page->ID == $_current_page->post_parent )
    			$css_class .= ' current_page_parent';
    
    		// $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape($page->post_title) . '">' . $page->post_title . '</a>';
    		// fixed by Tdude to give an id for the css
    		// observe extra variable $post_name initiating function
    		$output .= $indent . '<li class="' . $css_class . '" id="' . attribute_escape($page->post_name) . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape($page->post_title) . '"><span>' . $page->post_title . '</span></a>';
    
    		if ( !empty($show_date) ) {
    			if ( 'modified' == $show_date )
    				$time = $page->post_modified;
    			else
    				$time = $page->post_date;
    
    			$output .= " " . mysql2date($date_format, $time);
    		}
    
    		return $output;
    	}

    I tried to get this answer in the forums a few weeks back and I think I’ve posted my solution, but you know how it is…soo hard to find 😉
    Best wishes,
    T

    Then consider paying someone to do it. It should take 10 minutes.
    /T

    Forum: Plugins
    In reply to: Page slug as li id
    Thread Starter Tdude

    (@tdude)

    OK. Not a big deal. If you want your css li to show a slug as the id for each list item, change your wp-includes/classes.php somewhere around line 516 to something like this:
    // haxed by Tdude to give an id for the css
    // observe extra variable $post_name initiating function
    $output .= $indent . '<li class="' . $css_class . '" id="' . attribute_escape($page->post_name) . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape($page->post_title) . '"><span>' . $page->post_title . '</span></a>';

    It’s not a big hack codewise, just add a variable. The thing is I searched these forums for days (ok, nights) and didn’t find the answer.
    Remember, you can add several classes to an element, but only one id. That means using a numeric ID would probably be a better option. The site I’m using this for needs an understandable name in the css for li id’s and the corresponding background images, hence the hack. I know the sky will probably fall on my head using this with many javascript id’s in the plug-ins, but I’m using non-english slugs for the pages and li id’s, so I’ll probably be ok.

    Hmmm. I’ve upgraded all my 6-7 sites to 2.1. All MY OWN php hacks were of course terminated and I’m still having some issues, but considering how little time I put in for 2.1 I think it’s running great! How much more time did you spend on your 2.05 vs. 2.1? It could be months…
    Consider that for a second and send some thank you’s to all the gals n’ guys sweating what should be your dirty code work.
    Just a thought from a stormy Åre.
    /T

    Nah. That could be your graphics card. I have no jerkyness thing while scrolling in Mac/Firefox.

    Sure there is. Check your settings under user/profile
    /T

    Hi!
    I’m running WP on a IIS (Microsoft), I get blank pages all the time when hacking the files, because of server/php settings or something.
    I don’t know exactly what the clear cache would do to your files, but try backstepping any code changes you might have made to the other files. If that doesn’t work, switch to the default template after turning off the plug-ins. After that, try erasing the relevant server files and finally make a clean reboot after backing up your db.
    If you have recently upgraded to WP 2.1, maybe some files were left on the server?
    I’m no expert. Just trying to lend a hand 😉
    /T

Viewing 15 replies - 46 through 60 (of 69 total)