WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Simple fields assign to category

[Resolved] Simple fields assign to category

  • Hello,
    thank you for this great plugin. Even i don’t know anything bout php i managed it to create a custom side.
    Now my problem: i nserterted the code
    $selected_value = simple_fields_get_post_value(get_the_id(), array(1, 4), true);
    echo “Anbieter: $selected_value </br>”;
    // outputs: “Anbieter: “;
    into my single.php.
    Works fine, but now it is on every Post, even its not filled out. How can i assign this only to a specific categoryusing the code above?

    Thanks in advance.
    Tsurom

    http://wordpress.org/extend/plugins/simple-fields/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Pär Thernström

    @eskapism

    Something like this could perhaps do it:

    $selected_value = simple_fields_get_post_value(get_the_id(), array(1, 4), true);
    if ($selected_value) {
      echo "Anbieter: $selected_value </br>";
    }

    Thats it!!!
    Thank you!
    This tells the empty arguments not to appear? smart, thanks

    Hi Pär, one more question. All the field types works with this simple code, except the file field. This gives out a number instead of a picture. When i insert a picture in the textfield with WYSIWYG Editor it works.
    So what is missing in this code to show pictures:

    $selected_value = simple_fields_get_post_value(get_the_id(), array(1, 4), true);
    if ($selected_value) {
    echo “Anbieter: $selected_value </br>”;
    }

    Thanks again
    Tsurom

    Plugin Author Pär Thernström

    @eskapism

    If you use the file field, the number you get is the id of the image selected. You must then use another function,
    for example
    http://codex.wordpress.org/Function_Reference/wp_get_attachment_url

    Thanks for the answer, but i don’t understand it. I want in a field group with textboxes a pictures to chose and display on a post. I can realise it with the WYSIWYG Editor Textfield and the code
    $selected_value = simple_fields_get_post_value(get_the_id(), array(1, 4), true);
    if ($selected_value) {
    echo “Anbieter: $selected_value </br>”;
    }

    But it would be more elegant if there is only a picture to chose.
    As i mentioned before i have no idea about php, so i just used your examples and that worked fine for me.
    Is there a way to use the examplecode for a picture?
    Greetings from Japan
    Tsurom

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Simple fields assign to category’ is closed to new replies.