WordPress.org

Ready to get started?Download WordPress

Forums

[closed] Does WordPress 3 Hate PHP? (8 posts)

  1. dsmith21212
    Blocked
    Posted 3 years ago #

    This question is not about adding PHP to a post or comment. I gave up on that a long time ago.

    Has anyone else had a problem where even adding PHP directly to the source code does not work?

    The PHP that I am adding works perfectly on non-WordPress websites. So I know the problem is WordPress; not the code.

    The most obvious issue that I'm having is variables are not being filled or passed (they're not even being passed from one part of a page to the next, let alone between different pages).

    Oh. I should also mention that I've added code through the WordPress editor and by modifying files directly, then re-uploading them. I have also used Internet Explorer and Firefox.

    The blog itself works fine, also. So the server is not the issue here.

  2. webjunk
    Member
    Posted 3 years ago #

    Have added PHP hundreds of times.
    We would need to know the code you are trying to add and where.

  3. dsmith21212
    Blocked
    Posted 3 years ago #

    I don't usually attract trolls, so bare with me while I try to be nice...

    There are two typical newbie responses in forums: 'search the forum' and 'we need to know more'. Both roughly translate into "I'm freaking clueless but I desparately need attention (please mommy, hold me)."

    "Have added PHP hundreds of times."
    That's doubtful. Newbs like you just stumble around aimlessly spreading "webjunk" just to up your post count, get attention and hope to make yourselves look like 'experts' in the eyes of those you hope are newbier newbs than you.

    I'm not.

    "We would need to know the code you are trying to add and where."
    And there it is. This one screams, "Hey, I'm in a tech class, so I know more than you," or simply that you saw this newbie response on another thread and mistook it for a professional response.

    And your use of "we" instead of "I" clearly displays your "I need to belong to something" mentallity.

    The worst problem with these "look at me" responses is that other people, who might actually have an answer, may glance at the thread, see a response, and think that the question has been answered.

    It has not.

    Get off the thread, kid; you're fired.

  4. Samuel B
    moderator
    Posted 3 years ago #

    dsmith21212
    your attitude is NOT appreciated and I have little patience for rudeness
    you call webjunk a troll, yet what the hec are you?
    webjunk asked a legitimate question
    I can say the same - I've added php to wordpress 100's of time
    so do you want to answer the question or do you want to just go away?

  5. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    I'm sure your lovely response will draw the attention of all sorts of experts!! We volunteers here on the forums love being talked down to.

    But seriously....his response was pretty much on the button.... What are you trying to do, and where?

    I'm no php expert.....I do know my way around WP a bit.

    When you say source code....are you referring to the actual core files? Or plugin style, or to the theme/template source?

    Its hard to help without knowing what you are doing tho... most of my php stuff, I drop into various separate files (for organization sake) and call into functions.php...but dropping the php into functions.php works just as well. I'm just an organization freak.

    Globalize what I've set up at the beginning of any template

    <?php
    global $voodoo_current_settings;
    $ve_webmaster    = get_theme_option( 'webmaster' );
    $ve_favicon      = get_theme_option( 'favicon' );
    $ve_color_scheme = get_theme_option( 'color_scheme' );
    ?>

    for instance from the very top of my header.php file

    then apply it within the template

    This may be beginner stuff, but again, I have no idea what you are trying to do, or where

  6. dsmith21212
    Blocked
    Posted 3 years ago #

    Samuel B

    "you call webjunk a troll, yet what the hec are you?"

    Not a troll. (I can't believe a moderator just said, 'I know you are, but what am I?' - Even more ironic: I just got trolled by a moderator.)

    "webjunk asked a legitimate question"

    No. Webjunk asked a question that is neither here nor there. All the legitimate questions were answered in my post (all except the one that was asked, right?).

    A person who's answer to everything is 'we need more info' states clearly the fact 'I do not know'. If a person has no answer, why do they reply to questions at all (other than that whole 'getting attention' thing)?

    If I am looking to help people and all I find are questions that I have no answers for, I either look them up or leave them alone. How hard is that? Worst case scenario, I gain new knowledge (that's gotta suck. I mean, being able to answer the question next time it comes up; screw that.).

    "so do you want to answer the question or do you want to just go away?"

    Great lead in for this next part!

    Rev. Voodoo

    I'm no PHP expert, either, but I think it's safe to assume that you, at least, read the question. That's how experts are made; by reading the post, not just pasting a default reply.

    Your example code shows variables being filled in your header.php file. If I were to write the exact same code into the exact same location, it would not work. If I were to put that same code in any other location, it still wouldn't work.

    I seem to remember this stuff working before; maybe in WP 2.9. I could be wrong on the version. Could it be a security feature added since WP 3?

    Which brings up another idea. I'm using an analytics application on one of my sites that doubles as an anti-hacker tool (Crawl Track). On a few pages, I check the referring URL by the GET method.

    EXAMPLE:
    <?php $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; ?>

    But this program sees that as a code injection. Could WordPress maybe have a defense mechanism like this in place?

  7. elfin
    Moderator
    Posted 3 years ago #

    I think you are forgetting that this support forum relies on volunteers to help others out. Seeing someone reply in the way you did will in no way endear anyone into helping you. Negativity breeds negativity.

    Can WordPress stop you adding code to the core, no.
    Does it work for everyone but you, yes.
    However, hacking the core is frowned upon, as it impacts on future upgrades.

    So what code are you trying to add that apparently doesn't work? (oh wait you were asked for that before.)
    Where are you trying to add it? (and you were asked that as well)
    You do realise that your code could be perfectly valid, but you are just putting it into the wrong place!

  8. Samuel B
    moderator
    Posted 3 years ago #

    this is over

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.