Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Sorry for the confusion. I should have explained my particular situation from the beginning.

    Yes, but I’m using the style sheet from my already existing website. Instead of adding code to the style sheet and adding the div tag each time I use these functions, I can just add the parameter to call the class I’ve already created.

    IMO, my solution is more efficient.

    Those functions return something like this:

    <A href=”…”>text</A>

    Wrapping a DIV around the above and assigning a class to it does not apply the class to the text within the <A> tag.

    You need to assign the class directly to the <A> tag. The modifications I made to the functions accomplishes that.

    I found there were problems attaching classes to functions like edit_comment_link and edit_post_link.

    Here’s what I did:
    I went into wp-includes and opened templates-functions-links.php

    I changed the 2 functions to the following:

    function edit_post_link($link = ‘Edit This’, $before = ”, $after = ”, $CSSclass=”) {
    global $user_ID, $post;

    get_currentuserinfo();

    if (!user_can_edit_post($user_ID, $post->ID)) {
    return;
    }

    $location = get_settings(‘siteurl’) . “/wp-admin/post.php?action=edit&post=$post->ID”;
    echo “$before <a href=\”$location\””;
    if(!empty($CSSclass)) {
    echo ” class=\”” .$CSSclass.”\””;
    }
    echo “>$link $after”;
    }

    function edit_comment_link($link = ‘Edit This’, $before = ”, $after = ”, $CSSclass=”) {
    global $user_ID, $post, $comment;

    get_currentuserinfo();

    if (!user_can_edit_post_comments($user_ID, $post->ID)) {
    return;
    }

    $location = get_settings(‘siteurl’) . “/wp-admin/post.php?action=editcomment&comment=$comment->comment_ID”;
    echo “$before <a href=’$location'”;
    if(!empty($CSSclass)) {
    echo ” class=\”” . $CSSclass. “\””;
    }
    echo “>$link $after”;
    }

    Then I could add the class when I made the function call. Example:
    <?php edit_comment_link(‘edit’,”,”,’white’); ?>

    I’m new to wordpress, too, so if there is a better way to do this that I don’t know about, let me know. I didn’t see anything in my search.

    Thank you for posting this.

    I was having problems trying to figure what how to get the time assigned to a variable.

    Problem solved.

Viewing 5 replies - 1 through 5 (of 5 total)