dfwgreg
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Create a child theme from a child theme?Thanks
Forum: Plugins
In reply to: [WP-Polls] Poll doesn't workMake sure <?php wp_head(); ?> is in the header and <?php wp_footer(); ?> is in the footer.
Forum: Themes and Templates
In reply to: How to echo the url of an attachment?I appreciate the help but I found a solution:
<?php $images = get_children( array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ); foreach ($images as $imageId => $image); $wp_image = wp_get_attachment_image_src($imageId,'Major story img', false);?>
changing Major story img to whatever size I want and then output the img:
<?php echo ($wp_image[0]); ?>
I thank you for the help,
Gregory S.Forum: Themes and Templates
In reply to: How to echo the url of an attachment?Update: I found a way to display the image.
<?php echo wp_get_attachment_image( $attachment_id, 'Major story img' );?>
What I want is to display the url of that attachment, if possible.
Thanks again,
Gregory S.Forum: Fixing WordPress
In reply to: How to check for attachment and display a different image if notSolved:
<?php $attachments = get_children( array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'post_parent' => $post->ID )); if(count($attachments) > 0) { ?> <?php $attachments = get_children(array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order')); if ( ! is_array($attachments) ) continue; $count = count($attachments); $first_attachment = array_shift($attachments); ?> <?php echo wp_get_attachment_image($first_attachment->ID, 'thumbnail'); ?> <?php } else { ?> <img src="/img/alttv_small.jpg"> <?php } ?>
Forum: Networking WordPress
In reply to: Forward domain to first site?Did that and they point to the sign-up page. I’ll try it at the domain name level instead of the local server level (cPanel). See controlalttv.net for example.
Forum: Fixing WordPress
In reply to: Add div to group posts by date?Nevermind, I found a solution.
<?php $args = array( 'post_type'=>'wlinks' ); query_posts( $args ); ?> <?php $day_check = ''; while (have_posts()) : the_post(); $day = get_the_date('d'); if ($day != $day_check) { if ($day_check != '') { echo '</div>'; // close the list here } echo '<div>', get_the_date() ; } ?> <li><?php the_title(); ?></a></li> <?php $day_check = $day; endwhile; ?>
Sorry for clogging the forum,
Gregory S.Forum: Fixing WordPress
In reply to: Add a div when taxonomy is selectedYEA!!!
Thanks,
Gregory S.[Happy New Year!]
Forum: Fixing WordPress
In reply to: Add additional text to photo caption from a custom field?Got it:
<?php $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image') ); foreach ( $attachments as $attachment_id => $attachment ) { $credits = get_post_meta( $attachment_id, 'photo_credits', true ); if( !empty( $credits ) ) echo '<h2><span>','Image: ' . $credits . '</h2></span>'; } ?>
Forum: Fixing WordPress
In reply to: Add additional text to photo caption from a custom field?Update: I think I found a solution but I need to find a way to check for data in the custom field. This is what I have now:
<?php $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image') ); foreach ( $attachments as $attachment_id => $attachment ) { echo '<h2><span>','Image: ' . get_post_meta($attachment_id, 'photo_credits', true) . '</h2></span>'; } ?>
Any help would be greatly appreciated.
Thanks,
Gregory SchultzForum: Fixing WordPress
In reply to: get_header('whatever') problem in child themes<?php include( TEMPLATEPATH . 'header-whatever.php' ); ?>
TEMPLATEPATH = location of where your theme is located.
You can also substitute TEMPLATEPATH with the full path to the site.
Example:
<?php include( '/wp-content/themes/[FOLDER]/header-front.php' ); ?>
Hope this helps,
Gregory S.Forum: Fixing WordPress
In reply to: Migrating from WP site to a half WP siteLog into your WordPress site -> Click Tools -> Click Export
You have the option to only export posts.
– Gregory S.
Forum: Fixing WordPress
In reply to: Display data from custom field from attached image in postOK, I finally got it working but I need someone to verify that the code I have is correct. What I want it to do is check the custom field [photo_credits] for data, if it does then add the word ‘Image:’ before the text. I’ve done this before with the caption but I’m having problems trying to get it to work with the custom fields.
Here’s what I’ve done so far:
<?php $attachments = get_children( array('post_parent' => get_the_ID(), 'post_type' => 'attachment', 'post_mime_type' =>'image') ); foreach ( $attachments as $attachment_id => $attachment ) { if get_post_meta($attachment_id, 'photo_credits', true); echo '<h2><span>','Image: ' . echo get_post_meta($attachment_id, 'photo_credits', true); . '</h2></span>'; } ?>
If it helps, this code is based on the previous question – https://www.ads-software.com/support/topic/add-additional-text-to-photo-caption?replies=3
Thanks for all the help so far,
Gregory S.Forum: Fixing WordPress
In reply to: Display data from custom field from attached image in postI appreciate the help but it didn’t solve the problem. I’m using Bill Erickson guide for adding custom fields for image attachments
https://www.billerickson.net/wordpress-add-custom-fields-media-gallery/
It’s setup exactly as it is in the guide, I’m just stuck on how to get the custom field to be displayed on my site.
– Gregory S.
Forum: Themes and Templates
In reply to: Click next page to load next set of postsMoved the sidebar from top to bottom!