WordPress.org

Ready to get started?Download WordPress

Forums

Custom function not...funtioning (3 posts)

  1. Doodlebee
    Member
    Posted 6 years ago #

    Hey all. I wrote a custom plugin that locks in to the WP database and outputs some information in a seriously customized manner. On my localhost machine, it works perfectly. But I've uploaded it to my live server, and it *doesn't*.

    Basically, I have a functions.php file that has the customized scripting in it. I'll put a *short* example of it here - the file is pretty long, but it's broken up into three different scripts. But here's one section:

    function a_post_layout() { ?>
        <div class="post" id="post-<?php the_ID(); ?>">
    
    	<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h1>
    
    	<h2>by <?php the_author() ?></h2>
    
         <div class="entry">
    
    <?php the_content('Read more &raquo;'); ?>
    
         </div> <!-- /entry -->
    
    	<p class="postmetadata"><?php the_time('F jS, Y') ?> &nbsp; <?php the_time('g:i a') ?> &nbsp; <?php comments_popup_link('No Comments', 'Comment (1)', 'Comments (%)'); ?></p>
    
        </div> <!-- /post -->
    }

    Yes, I know it's the main section of the index.php area. But the thing is, this is really customized, and when I did what I had to do in the index.php file, it looked like a jumbled mess. I'm actually calling in this very section of code in several places on the site, using many conditionals, so it seemed like a good solution to just place the section in the functions.php file, and then, where I needed this to show, I could just call it into where I needed it by using <?php a_post_layout(); ?>, and then the only place I'd have to edit it (if I needed to) was in the functions.php file, rather than going through all the other files and changing things over and over again.

    I also have a sidebar that uses this type of thing, as well (but the code is more involved, because it's an *extremely* customized sidebar).

    Like I said, on my localhost setup, it works perfectly. But when I put it on the live server, the functions aren't recognized, it seems. I have it set up exactly how I do on my localhost, but it's like it can't read anything, and where stuff *should* be, there's nothing.

    I tried converting it to a plugin, but it has the same result - the code is apparently fine (I have no error messages), but the stuff that's *supposed* to show up, doesn't.

    What should I look for to see how my localhost setup is different than my live hosting space? From what I can tell, everything is exactly the same (I even have my posts and Pages with the same ID#s and everything - it's *got* to be this code, or somethign on the server that's just not letting it through.)

    Would anyone have any suggestions for me?

  2. Doodlebee
    Member
    Posted 6 years ago #

    For the record, I should also note that my localhost server runs MySQL5/PHP5 and my live server (the one that's not showing anything) is running MySQL4/PHP4.

    Part of the code I am running is fetching information from the database using mysql_fetch_assoc() and mysql_fetch_row() calls.

    I'm wondering if this has something to do with the issue I'm having - any points in the right direction would be appreciated.

  3. Doodlebee
    Member
    Posted 6 years ago #

    I got it. Yet another one to chalk up to Shelly's "Duh" factor. Don't even ask. It was just *really* dumb on my part. (Why, oh why can we not delete our "I'm dumb" threads? LOL)

Topic Closed

This topic has been closed to new replies.

About this Topic