Jump to content

slobjones

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Everything posted by slobjones

  1. This topic combines WordPress conditional statements with PHP. Hoping to get some help here. I'd like to create a dynamic WordPress menu with a mix of static pages and custom post type archives that applies a class of "current" to the current tab. The example below uses 1) Static page set as Home 2) Static page 3) Custom post type archive 4) Static page for blog content. Tried to edit the code from my previous menu, but it's not working (see below). I'd appreciate any assistance! Thanks. <ul> <li<?php if ( is_front_page() ) { echo ' class="current"'; } ?>><a href="/">Home</a></li> <li<?php if ( is_page('my-page') { echo ' class="current"'; } ?>><a href="/my-page/">My Page</a></li> <li<?php if ( is_post_type_archive('my-custom') && is_single()) { echo ' class="current"'; } ?>><a href="/my-custom/">My Custom Posts</a></li> <li<?php if ( is_page('blog') { echo ' class="current"'; } ?>><a href="/blog/">Blog</a> </li> </ul>
  2. I'm trying to place a Guest Author field in my WP index.php and single.php templates. Inserted some code in functions.php: // guest author custom field add_filter( 'the_author', 'guest_author_name' ); add_filter( 'get_the_author_display_name', 'guest_author_name' ); function guest_author_name( $name ) { global $post; $author = get_post_meta( $post->ID, 'guest-author', true ); if ( $author ) $name = $author; return $name; } This works fine when I select the custom field and fill in a guest author's name. But if I don't use a custom field because I'm publishing my own post, the author's name is left blank on the blog! I edited my index.php and single.php templates to replace this: <?php the_author (); ?> with this: <?php echo get_post_meta($post->ID, 'guest-author', true); ?> What am I missing here? Thanks.
  3. I need to place sidebar content on my WordPress blog that appears on the home page only. This means the content should display only at mysite.com and not at mysite.com/page/2/ Normally, I would just create a new sidebar.php template. But in this case, both the home page and inside pages use the same home template, index.php -- which means they both use the same sidebar. Is there a conditional statement, perhaps using the WordPress tags is_home and/or is_page, that would allow me to display a different sidebar on inside pages? Thanks.
  4. I'd like my WordPress menu to highlight the category when a single post is displayed. This example from the WordPress codex properly applies the class of "current" in category view, but does not apply the class (although it should) when switching to single-post view: [pre]<li<?php if ( is_category('10') || in_category('10') && !is_single()) { echo ' class="current"'; } ?>><a href="/?cat=10">My Category</a></li>[/pre] Any thoughts? Thanks.
  5. [!--quoteo(post=372938:date=May 10 2006, 10:26 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ May 10 2006, 10:26 AM) [snapback]372938[/snapback][/div][div class=\'quotemain\'][!--quotec--] Check the error log, and post whatever messages appear in said log. [/quote] Here's a nice, fresh error log. I started XAMPP Control Panel, performed a refresh and status check and got this in the error log: [Wed May 10 13:07:47 2006] [crit] (22)Invalid argument: unable to replace stderr with error_log [Wed May 10 13:07:47 2006] [crit] (2)No such file or directory: unable to replace stderr with /dev/null [Wed May 10 13:07:54 2006] [crit] (22)Invalid argument: unable to replace stderr with error_log [Wed May 10 13:07:54 2006] [crit] (2)No such file or directory: unable to replace stderr with /dev/null [Wed May 10 13:08:06 2006] [notice] Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.2 configured -- resuming normal operations [Wed May 10 13:08:06 2006] [notice] Server built: Dec 1 2005 18:36:53 [Wed May 10 13:08:06 2006] [notice] Parent: Created child process 1244 [Wed May 10 13:08:22 2006] [notice] Child 1244: Child process is running [Wed May 10 13:08:22 2006] [notice] Child 1244: Acquired the start mutex. [Wed May 10 13:08:22 2006] [notice] Child 1244: Starting 250 worker threads. [Wed May 10 13:08:22 2006] [notice] Child 1244: Starting thread to listen on port 443. [Wed May 10 13:08:22 2006] [notice] Child 1244: Starting thread to listen on port 80. I've found now that if I run XAMPP-restart, MySQL will operate, even though XAMPP-restart first reports: "Can't connect to MySQL server on localhost (10061)." A check of the error log then shows: [Wed May 10 13:12:57 2006] [notice] Apache/2.2.0 (Win32) DAV/2 mod_ssl/2.2.0 OpenSSL/0.9.8a mod_autoindex_color PHP/5.1.2 configured -- resuming normal operations [Wed May 10 13:12:57 2006] [notice] Server built: Dec 1 2005 18:36:53 [Wed May 10 13:12:57 2006] [notice] Parent: Created child process 5648 [Wed May 10 13:13:30 2006] [notice] Child 5648: Child process is running [Wed May 10 13:13:30 2006] [notice] Child 5648: Acquired the start mutex. [Wed May 10 13:13:30 2006] [notice] Child 5648: Starting 250 worker threads. [Wed May 10 13:13:31 2006] [notice] Child 5648: Starting thread to listen on port 443. [Wed May 10 13:13:31 2006] [notice] Child 5648: Starting thread to listen on port 80. XAMPP Control Panel reports: ERROR: Status Check Failure [1] ERROR: Status Check Failure [2] But at that point, I can run localhost in my browser and MySQL operates with no problem. So maybe I should just run it this way and ignore the error messages.
  6. I can't keep MySQL running. I start it, it turns itself off. This started today, after a week with no problems. I've tried it with installations of EasyPHP and now XAMPP. Same problem. I've tried removing the whole thing and reinstalling. Nothing changes. Could there be some MySQL configuration files on my system that I'm missing? Thanks.
  7. I just installed XAMPP Lite. When I start the control panel and then start Apache and MySQL, Apache starts, MySQL starts, and then MySQL shuts itself off. However, even though it's off, the MySQL status button doesn't change from "Stop" to "Start". It still says "Start". I've tried removing XAMPP and installing it again. I've rebooted several times. But nothing changes. I don't think the error has anything to do with XAMPP, though. It's something to do with MySQL. I had EasyPHP running before I installed XAMPP. Everything was fine for a week, until MySQL quit working. I removed the entire installation, installed EasyPHP again, removed it, installed XAMPP. Same problem. Could there be some MySQL configuration files still sitting on my system somewhere that I need to remove?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.