Forum Replies Created

Viewing 15 replies - 1 through 15 (of 196 total)
  • Thread Starter deko

    (@deko)

    I revised the first lines of my script to this:

    date_default_timezone_set('America/Los_Angeles');
    $timestamp = time();

    This fixed whatever WordPress did that made the PHP time() function return a value different from what time() would get from non-wp pages.

    Thread Starter deko

    (@deko)

    <?php get_the_time( $d, $post ); ?>

    Returns the time of the current post for use in PHP. It does not display the time.

    get_the_time

    So do I have to unravel whatever get_the_time is doing? Is there some function I can run, before my script runs, that will reset PHP so it will return the expected value from time()?

    Thread Starter deko

    (@deko)

    Thanks for the reply. The WordPress Firewall 2 plugin looks interesting, but I was more interested in how the default wordpress htaccess file is any better than using a simple ErrorDocument, and also thoughts on that htaccess file form wprecipies.com.

    Thread Starter deko

    (@deko)

    ugh. it may not look like it, but there’s a lot of difference between 1 and l

    solution: esc_attr( get_the_date('l') )

    Forum: Plugins
    In reply to: SQL to get cat ids of posts
    Thread Starter deko

    (@deko)

    corrected…

    $thispost = $_GET["p"];
    SELECT term_taxonomy.term_id FROM term_taxonomy INNER JOIN term_relationships ON term_taxonomy.term_taxonomy_id = term_relationships.term_taxonomy_id INNER JOIN posts ON posts.ID = term_relationships.object_id WHERE (posts.ID = ".$thispost.");

    Thread Starter deko

    (@deko)

    thanks esmi. after reading that page, my impression is that the wp developers hardcoded hyperlinked comment dates in order to provide permalinks to comments.

    reasonable enough. perhaps I should simply style the link so it doesn’t look like a link.

    for those who *really* don’t want hyperlinked comment dates, line 1362 to line 1637 of wp-includes/comment-template.php can be modified to this:

    <div class="comment-meta commentmetadata">
      <?php printf( __('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?>
      <?php edit_comment_link(__('Edit'),'  ','' ); ?>
    </div>

    which removes the following line of code:

    <a href="<?php //echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">

    along with the closing </a> in the following line.

    this will prevent comment dates from being hyperlinked.

    Forum: Plugins
    In reply to: SQL to get cat ids of posts
    Thread Starter deko

    (@deko)

    actually, 1 join shd do it…

    $thispost = $_GET["p"];
    SELECT term_relationships.term_taxonomy_id FROM term_relationships INNER JOIN posts ON posts.ID = term_relationships.object_id WHERE (posts.ID = ".$thispost.");

    assuming the post is in only one category

    Forum: Plugins
    In reply to: SQL to get cat ids of posts
    Thread Starter deko

    (@deko)

    Yes, I do 3 joins…

    $thispost = $_GET["p"];

    "SELECT term_relationships.term_taxonomy_id FROM terms INNER JOIN (term_taxonomy INNER JOIN (term_relationships INNER JOIN posts ON posts.ID = term_relationships.object_id) ON term_relationships.term_taxonomy_id = term_relationships.term_taxonomy_id) ON terms.term_id = term_taxonomy.term_id WHERE (posts.ID = ".$thispost.") LIMIT 1;"

    isn’t normalization great?

    Forum: Plugins
    In reply to: SQL to get cat ids of posts
    Thread Starter deko

    (@deko)

    Actually, that query DOES work. All it needs to a WHERE clause. Still, it’s ugly. Is there a better way?

    Remember, NOT in the loop…

    What if I grab the post ID like this: $postid = $_Get["p"]

    I want to discover what the corresponding category ID is for that $postid.

    Do I have to run a query with 3 joins to find it?

    got it working. can’t use $_GET in my scripts anymore. and if I switch back at a later date, bookmarks break.

    staying ugly for now…

    I guess I should take that as encouragement to give it a shot. thx for the reply.

    I see. I’m curious what changes are made in the database.

    But those changes, in addition to adding to my htaccess file, is pushing the complexity price a little too high… even though I do think URL structure is an important part of the interface for any website.

    Thread Starter deko

    (@deko)

    While $post->post_title certainly does return the post title, the problem is passing it to my script.

    This code doesn’t work:

    <?php
    $viewed = $post->post_title;
    @ include '/home/user/public_html/cgi-bin/myscript.php?id=$viewed';
    ?>

    It would work if I called it like this:

    $viewed = $post->post_title;
    @ include 'http://www.myblog.org/myscript.php?id=$viewed';
    ?>

    but I don’t want my myscript.php publicly accessible.

    There must be an easy way to log post_title on each page view…

    Thread Starter deko

    (@deko)

    Thanks MichaelH. I’ll give it a toss and let you know.

    I’ve looked at a number of wp plug-ins but all I really want are the top 5 pages, sorted by page views, and the ability to insert these stats wherever I want on my blog.

    Thread Starter deko

    (@deko)

    no one would – unless they’re looking for some security vulnerability.

    Here’s the fix:

    <?php if (@constant('WP_USE_THEMES')) : ?>
    <form id="searchform" method="get" action="<?php bloginfo('home'); ?>">
    <input type="text" name="s" id="s" size="25" />&nbsp;&nbsp;
    <input type="submit" value="<?php esc_attr_e('Search'); ?>" />
    </form>
    <?php endif; ?>
Viewing 15 replies - 1 through 15 (of 196 total)