php/wordpress code

Discussion in 'PHP' started by tony84, Mar 2, 2008.

  1. #1
    I will try to explain this as best i can.

    I run a site on wordpress. Its the football link in my sig. In the top left hand corner there is a place for a photo. I currently have to keep uploading a new picture every time i update the news article (which i do many times a day).

    Im wondering if there is some type of code that can go off the "Tags" section in the wordpress admin panel. So for instance if i put tag saying ronaldo then it will display ronaldo.jpg if i was to put a tag saying backham it would display beckham.jpg etc etc

    Im sure this can be done as nothing is impossible but is it easy to do as my php is pretty limited.
    Can anyone help?

    thanks tony
     
    tony84, Mar 2, 2008 IP
  2. FreeHider.Info

    FreeHider.Info Banned

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I dont think,it can be done..
    Well,it can be done,but it will again cost a lot..
    So why to waste so much money,when you can get it for a few.. Well,i can help you . PM me now...
     
    FreeHider.Info, Mar 2, 2008 IP
  3. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #3
    Im sure it can be done but you will need to edit the code.

    Basically right before it displays the picture do a switch of if statement.

    if tag == "ronaldo"
    code for showing ronaldo picture

    ect.
     
    aaron_nimocks, Mar 2, 2008 IP
  4. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #4
    I initially thought if tag = ronaldo then display ronaldo.jpg

    The problem with that is that i would need to have loads of if statements.
    As in 1 if statement for every player/team/manager etc it would be a big job thats why im wondering if there is a way of saying

    if tag = "ronaldo" then add .jpg and display tag+.jpg

    if that makes sense
     
    tony84, Mar 2, 2008 IP
  5. aaron_nimocks

    aaron_nimocks Im kind of a big deal Staff

    Messages:
    5,563
    Likes Received:
    627
    Best Answers:
    0
    Trophy Points:
    420
    #5
    Ya you can do that also since there is so many of them.

    basically it would be that you pull the tag from DB and get it into a variable (should be done already). Then for the picture use that variable. To make it even easier you can save the tag as name.jpg so theres less code to do.
     
    aaron_nimocks, Mar 2, 2008 IP
  6. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #6
    i suppose the tag could be name.jpg but i would prefer it to do it the other way.

    So now we have established it can be done and the best way to do it does anyone know of any mods already made or any code i can use to start with that i can edit or eve better any code that is already done?
     
    tony84, Mar 2, 2008 IP
  7. donross

    donross Active Member

    Messages:
    90
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    98
    #7
    i think you can do this without any plugin.. you just need to "add custom field" = (pics path) that will pull the pics from your pics folder ... you just have to do a little php in order the wordpress to locate the file (but you will have to include this custom field everytime you post which is a part of you single post )... you just need to do a little if condition if you want to control which pics you want to use... e.q. if is_page(), is_home() etc....
     
    donross, Mar 3, 2008 IP
  8. tony84

    tony84 Well-Known Member

    Messages:
    1,864
    Likes Received:
    29
    Best Answers:
    0
    Trophy Points:
    140
    #8
    i thought about the add custom field but its much easier to just do it through the tag bit as i will be getting a couple of writers to help me eventually. I want everything to be as easy as possible and as less time consuming as possible also.
     
    tony84, Mar 3, 2008 IP
  9. Panzer

    Panzer Active Member

    Messages:
    381
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    58
    #9
    In reply to your PM, im not familiar with wordpress API, i prefer coding things from scratch or SMF modding.
     
    Panzer, Mar 3, 2008 IP
  10. LeopardAt1

    LeopardAt1 Well-Known Member

    Messages:
    880
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #10
    Job started today and done. Thanks.
     
    LeopardAt1, Mar 25, 2008 IP