derekdbess
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Click "Add Category" and "Add Custom Field" But Nothing Happens?Alright, after messing around with the functions file. I removed the line break after the IF statement and now everything is working. For some reason the functions file doesn’t like line breaks.
Forum: Fixing WordPress
In reply to: How can you remove title form widgets?I’ve already done this, but the idea is that some widgets we’d like to display the title, and other we wouldn’t.
And I’m still creating the theme from scratch. I’m new to wordpress so it’s been a fun adventure thus far.
Would there be a way to do it through the functions file?
This is what I have for one of the widgets:
register_sidebar(array( 'name' => 'pages sidebar', 'before_title' => '<h3>', 'after_title' => '</h3>', 'before_widget' => '<div>', 'after_widget' => '</div>' ));Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"Life saver! Thanks again!
Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"esmi,
I will definately do that.
Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"Thanks for the info Big Bagel! Much appreciated.
And yes, they were very fast replies. I’m just glad the community here is so helpful. I just pray that I’m able to learn some PHP & WordPress development from everyone.
Again, thank you all for the help. I wish there was a way I could repay you.
Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"Jackson,
The below code worked. So let me ask you all this. You say it’s bad practice to use “post” as a variable. I grabbed this from the wordpress codex for a different section of a page where I’m displaying a custom field. Should I change this as well?
<?php echo get_post_meta($post->ID, "thumbnail", true);?>
This is the code that worked:<?php $args = array( 'numberposts' => '4', 'category' => 4 ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts as $recent ){ echo '<li><div style="float: left;">' . get_post_meta($recent["ID"], "thumbnail", true) . '</div><span><a href="' . get_permalink($recent["ID"]) . '" title="Look '.$recent["post_title"].'" >Read More</a></span></li> '; } ?>Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"No, it’s the correct name for the field.
And I used the code from the codex and thought I could just replace the code for $post[title] with “get_post_meta” but it just doesn’t work. Like perhaps get recent posts doesn’t pass the custom field data?
Perhaps I need a different tag inorder for it to work?
Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"esmi,
how would I go about dumping the recent posts array?
Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"Jackson,
Everything is displaying correctly except the custom field isn’t displaying. I get custom fields to display on the actual page it self, but not when I’m listing multiple posts. I’ve been trying to figure this out for the past couple of hours and it’s really frustrating.
Forum: Fixing WordPress
In reply to: How can you display "custom fields" within "wp_get_recent_posts"Jackson,
Just tried that and still it’s not showing the custom field within recent_posts.