• I use the custom field template to show a list of questions and answers in my posts and it works great. However, I also want to use it to be able to put in custom thumbnails – so I would like to hide this field (which is a url of the image location) from being shown in my posts. How do I do this?

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hey,

    Do you know javascript?

    You can use the instructions area of the Custom Field Template to write your own javascript.

    <script type="text/javascript" language="javascript">
    jQuery(document).ready(function() {
       jQuery('#idofcustomfield').hide();
     });
    </script>

    Thread Starter lclough

    (@lclough)

    Thanks. However, it’s not working. When I do “Export Options” in the Custom Field Template Settings, it looks like this:

    [thumb]
    type = text
    size = 100
    label = Thumb
    output = false

    “;s:11:”instruction”;s:141:”<script type=\”text/javascript\” language=\”javascript\”>
    jQuery(document).ready(function() {
    jQuery(\’thumb\’).hide();
    });
    </script>”;s:8:”category”;s:0:””;s:4:”post”;s:0:””;s:9:”post_type”;s:0:””;s:16:”custom_post_type”;s:0:””;s:14:”template_files”;s:0:””;s:7:”disable”;N;}}}

    Close:

    [thumb]
    type = text
    size = 100
    label = Thumb
    output = false
    class = thumb

    And

    <script type="text/javascript" language="javascript">
    jQuery(document).ready(function() {
       jQuery('.thumb').hide();
     });
    </script>
    Thread Starter lclough

    (@lclough)

    You are so wonderful to help me. But, it is still not working. I copied and pasted exactly what you have above. When I export options, it looks like this:

    [thumb]
    type = text
    size = 100
    label = Thumb
    output = false
    class = thumb
    ";s:11:"instruction";s:142:"<script type=\"text/javascript\" language=\"javascript\">
    jQuery(document).ready(function() {
       jQuery(\'.thumb\').hide();
     });
    </script>";s:8:"category";s:0:"";s:4:"post";s:0:"";s:9:"post_type";s:0:"";s:16:"custom_post_type";s:0:"";s:14:"template_files";s:0:"";s:7:"disable";N;}}}

    Ok try another way.
    Make a file and put it into your theme directory.
    “cft.js” and link to it using the same technique e.g. in the instructions area of the CFT:

    <script type="text/javascript" language="javascript" src="/wp-content/yourtheme/cft.js"></script>

    Paste the above code into cft.js:

    jQuery(document).ready(function() {
       jQuery('.thumb').hide();
     });

    If that doesn’t work then you might have a conflict with another plugin. I have seen this happen before, turn off all your plugins and just have the CFT plugin working.

    Happy to help.

    Thread Starter lclough

    (@lclough)

    I disabled all the plugins except CFT, but no luck. So then I followed your last set of instructions and it still didn’t hide the thumb custom field.

    I use TimThumb to read the thumb field and make it into a thumbnail for my posts. It is tied to my theme (Lifestyle). I’m assuming at this point that it is the problem.

    So I followed the instructions at the link below to completely change how I indicate a thumbnail, and it’s working.

    https://www.studiopress.com/wordpress-tips/using-post-thumbnails-on-studiopress-classic-themes.htm

    Thank you so much for your patience in helping me troubleshoot this. I wouldn’t have been able to solve this with you!

    Could someone please elaborate on what this plugin does?

    I have a feeling this could be helpful, but amnt sure – does it change the format of the posts/pages .. thanks!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: Custom Field Template] Hiding a Custom Field in Posts’ is closed to new replies.