Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Define Variable Values in WordPress Post

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #33425
    stevendeeds
    Member

    Hey guys, this is my first post here, hopefully I can find some useful information.

    Basically, I’m using wordpress as my blogging engine on a section of my site. I set up several if/else statements in the theme, that I use in the non wordpress sections of my site, and I would like to be able to define the variables depending on what the post calls for.

    A simplified version of my question would be this…

     

    Post Body

    Possible?

    #83433
    stevendeeds
    Member

    Still No responses on this post, need your help guys!

    #83419
    TheDoc
    Member

    I suppose I don’t really know what you’re asking!

    If you asking if you can use other PHP beside WordPress, then of course!

    #83420
    stevendeeds
    Member

    Hey Doc, what im asking is, I want to be able to define my variables in a wordpress post.. i.e. Say I have an if/else statement in my footer.. if $var is set then echo $var, else don’t. And I want to be able to post a new article and in certain articles define $var as “hello world”.. is it possible?

    #83301
    dhechler
    Member

    I think i know what you are saying. You should try


    if (isset($var)){
    echo $var;
    }

    you could put an else statement in there, but theres not really a point.

    #83302
    dhechler
    Member

    Can you explain a bit more. Here is what I’m understanding.

    1. set an if statement in your footer to check if $var is defined in the current post you are on.
    2. be able to define $var in your post.

    #83292
    stevendeeds
    Member

    yea, and that was just an example.
    Another example would be defining custom keywords in my meta data using variables.

    I know how to use an if/else statement.. that’s not what I was asking. I just want to be able to define variables in wp pages and posts in the tinymce editor

    #83270
    Brightonmike
    Member

    I think what you’re looking to do needs you to use custom fields, you can’t put php of any sort in the editor.

    #83264
    dhechler
    Member

    @Brightonmike is right. You should use either custom fields or just tag your post with tags and then list out your tags in your metadata.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Back End’ is closed to new topics and replies.