nemci7v
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Disable HTML escape in title tags?
Forum: Fixing WordPress
In reply to: Changing image link urlThanks esmi! I have uploaded several pictures with url link. Is there a function that will link all uploaded images on my site to the file?
Forum: Fixing WordPress
In reply to: Get custom fields from multiple metaboxesThanks for the reply David! I’m not sure how “post types” is relevant to what I need. I’m working with custom fields in posts. In my functions.php file I’m registering multiple metaboxes using multiple arrays for each set of fields:
$meta_boxes[] = array( 'id' => 'products', 'title' => 'Products', 'pages' => array('post', 'page', 'link'), // multiple post types, accept custom post types 'context' => 'normal', // normal, advanced, side (optional) 'priority' => 'high', // high, low (optional) 'fields' => array( array( 'name' => 'something', 'id' => $prefix . 'something', 'desc' => '', 'type' => 'checkbox' ), //more arrays for other fields ) ); //another metabox array $meta_boxes[] = array( 'id' => 'customers', 'title' => 'Customers', //etc...
I’m able to echo all fields in a post using:
$custom_field_keys = get_post_custom_keys(); foreach ( $custom_field_keys as $key => $value ) { $valuet = trim($value); if ( '_' == $valuet{0} ) continue; echo $value . ":<br />"; echo get_post_meta($post->ID, $value, true) . "<br/><br/>"; }
My goal is to get fields for specific metaboxes. For example get all field values of “products” or “customers”.
Forum: Fixing WordPress
In reply to: Get array of custom fields in postThanks! It works. For the first $value would it be possible to get the field name instead of id?
Forum: Fixing WordPress
In reply to: Limit excerpt length by charactersphp has so many ways..
Forum: Fixing WordPress
In reply to: Limit excerpt length by charactersMate I’ve found a simpler method in an old theme I made.
<?php echo substr(get_the_excerpt(), 0,30); ?>
It does the same thing.
Forum: Fixing WordPress
In reply to: Limit excerpt length by charactersBrilliant! This works very nicely. Thanks jakep!
Forum: Fixing WordPress
In reply to: Deleting tables when plugin is uninstalledThanks that a great tutorial!
The plugin stores a lot of data like IP addresses, I think it’s a good idea to delete that excess data if someone doesn’t need it anymore
Forum: Fixing WordPress
In reply to: Adding data to table (database)yes that did it! thanks again!
Forum: Fixing WordPress
In reply to: Adding data to table (database)nvm I forgot to put a semicolon.. but now when I try and publish a new post I get
Fatal error: Call to a member function insert() on a non-object
for
$wpdb->insert( 'post_votes', array( 'post_id' => $post_ID, 'up' => 0, 'down' => 0 ), array( '%s', '%d' ) )
Forum: Fixing WordPress
In reply to: Adding data to table (database)Thank you for the reply!!! I’m finally on the right track ??
I tried this in my plugin file
function test_it($post_ID) { $wpdb->insert( 'post_votes', array( 'post_id' => $post_ID, 'up' => 0, 'down' => 0 ), array( '%s', '%d' ) ) return $post_ID; } add_action ( 'publish_post', 'test_it' );
and when I activate teh plugin I get
Parse error: syntax error, unexpected T_RETURN
on the function.. not sure if I’m doing this right
Forum: Fixing WordPress
In reply to: change the color of the link?Add a color property for links to the class your posts are wrapped in.
For example
.post-block a{ color:blue; }
Forum: Fixing WordPress
In reply to: Insert value in table when new post is created.Sorry to be so persistent.. In general my question is, how to add data to a table other than the default “wp_posts” when publishing a new post.
Forum: Fixing WordPress
In reply to: Insert value in table when new post is created.bump ??
Forum: Fixing WordPress
In reply to: Counting posts that contain a custom metavtxyzzy that’s brilliant your code worked perfectly without any issues! Thanks so much! ??