Hello, I want to use the custom fields as a height and width for a div in my custom made news slider. What code should I put for example in
<div style="width: <?fancyphpcode>px; height: <?anotherfancycode>px;">
Thanks in advance.
Hello, I want to use the custom fields as a height and width for a div in my custom made news slider. What code should I put for example in
<div style="width: <?fancyphpcode>px; height: <?anotherfancycode>px;">
Thanks in advance.
If you have custom fields
width 100px
height 60px
then the code as follows
$width = get_post_meta($post->ID, 'width', true);
$height = get_post_meta($post->ID, 'height', true);
<div style="width: <?php echo $width; ?> height: <?php echo $height;?>">get_post_meta($post_id, $custom_filed_id, true); You can read more here http://codex.wordpress.org/Custom_Fields
So, if you have custom field id width, then you would use this code to get a value in your template file
<?php $myWidth = get_post_meta($post->ID, 'width', true);
<div style="width: <?php echo $myWidth; ?>px; "></div>You must log in to post.