charlesolaes
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: q: about add_settings_field() parametersI was just taking a look around the template.php and found that the $args parameter in add_settings_field gets used in a php function call_user_func($field[‘callback’], $field[‘args’]); which resides in the do_settings_field function.
is $field[‘args’] the same as the $args parameter specified in add_settings_field()?
Found in /wp-admin/includes/template.php -> line 1200
Forum: Fixing WordPress
In reply to: Get 3 Most Recent PostsIf I understood it correctly, the wp_get_recent_posts() for tweets is working and you just need to get the featured image of that post?
Well, first we need to make sure that your theme supports post thumbnails by adding this to your functions.php
if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); }you can use the_post_thumbnail( $size, $attr ) function to display your images but must be done within the loop.
alternatively you can call get_post_thumbnail_id() to get the ID and use wp_get_attachment_url() to get the url
ex:
//I haven't tested this yet $thumb_id = get_post_thumbnail_id($post['ID']); $url = wp_get_attachment_url($thumb_id); echo "<img src='".$url."' /> //I suggest using timthumbs to crop the pictures incase they're too bigRead http://codex.wordpress.org/Post_Thumbnails For more information
Forum: Fixing WordPress
In reply to: Get 3 Most Recent PostsI see, let’s try to troubleshoot this a bit.
Check your $args, I see that post_type only has one single quote (missing opening ‘ ) on it, but maybe that’s just a typo in this forum post. Also, make sure that ‘post_type’ => ‘story’ is actually a custom post type, maybe ‘story’ is actually a Category/Term or Custom taxonomy you added.
Check if any values are actually being returned in your $recent_posts. do something like print_r($recent_posts) or var_dump($recent_posts) to see if anything is returned.
Test different variations of your $args, like taking out the offset or numberpost. This will help us determine where the problem lies.
Maybe try using a different wordpress function to get you posts like get_posts.
Forum: Fixing WordPress
In reply to: Get 3 Most Recent PostsHmm, make sure your arguments are correct, I can’t see anything wrong with the code. What output are you getting?
Forum: Fixing WordPress
In reply to: Same widgets on every pageCool, glad it worked out. please mark the thread as resolved.
Forum: Fixing WordPress
In reply to: Javascript only works without wp_headtry putting second block of code in a function and adding a hook to it
function my_function(){ if ( !is_admin() ) { // instruction to only load if it is not the admin area // register your script location, dependencies and version wp_register_script('clipboard', 'http://www.creativepatience.com/sample_blog/js/clipboard.js', array('jquery'), '1.0' ); // enqueue the script wp_enqueue_script('clipboard'); wp_register_script('zeroclipboard', 'http://www.creativepatience.com/sample_blog/zeroclipboard/ZeroClipboard.js', array('jquery'), '1.0' ); // enqueue the script wp_enqueue_script('zeroclipboard'); } } //add_action('init', 'my_function'); //I THINK you can use wp_head and wp_enqueue_script as hooks as wellForum: Fixing WordPress
In reply to: Same widgets on every pagedepending on your theme, you can choose what template to load for pages. Go to Pages>Edit and look for page attributes, you may need to activate it in the Screen Layout on the top if you don’t see it.
If you don’t see a dropdown menu that will allow you to choose a layout that means you may need to add it to your theme via child theme or editing the main theme. See http://codex.wordpress.org/Widgets_API#Display_Sidebar_on_Theme For more details, it’s a bit of a read though.
Forum: Fixing WordPress
In reply to: Javascript only works without wp_headtry using wp_enqueue_scripts instead. http://codex.wordpress.org/Function_Reference/wp_enqueue_script
Just make sure you add the correct dependencies when registering your clipboard scripts
Forum: Themes and Templates
In reply to: curious about how theme updatesCool, thanks man.
Forum: Fixing WordPress
In reply to: question about wp_enqueue_scriptoh cool, I wasn’t aware that wp_enqueue_scripts could be used as a hook, thanks a bunch, it’s working now and I learned something new. thanks again
Forum: Fixing WordPress
In reply to: question about wp_enqueue_scriptThanks for the suggestion, but I tried changing the add_action(‘init’) to wp_head but the scripts doesn’t seem to load at all. will wp_enqueue_script work outside the init action hook?
Forum: Fixing WordPress
In reply to: question about wp_enqueue_scriptcool, but it’s still loading scripts everywhere. here’s the code I’m using
[Code moderated as per the Forum Rules. Please use the pastebin]
Forum: Fixing WordPress
In reply to: getting posts from custom taxonomythanks curtiss, turns out my query was a bit wrong, there was suppose to be an array within that array so the corrent syntax should be.
$args = array( 'tax_query' => array( //another array array( 'taxonomy' => $this->taxonomy_name, 'field' => 'slug', 'terms' => $category) ), 'post_type' => $this->post_type_name );Forum: Fixing WordPress
In reply to: is editing the .htaccess safe?cool thanks! just wanted to make sure because some hosts require you to do some editing in the .htaccess to use the php 5.3.x
Forum: Fixing WordPress
In reply to: problem with conditional tagsThanks man, just when I thought I got WordPress all mapped out, this hits. I guess there’s still loads for me to learn.