images in wordpress themes

Its never a good idea to store binary data in your database, take a look at this post: https://stackoverflow.com/questions/662488/would-you-store-binary-data-in-database-or-in-file-system and this post: https://stackoverflow.com/questions/5778380/why-store-binary-data-in-mysql In my opinion, its far faster to use the file system and here’s why: The image URL can be stored in a custom field by wordpress – this is very simple to … Read more

Echo used hierarchical taxonomies parent name

Try this: <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); $parent = get_term($term->parent, get_query_var(‘taxonomy’) ); echo $parent->name; ?> You have to get the current term slug and then use get_term by the slug and then echo the name.

Plugin List Category: post custom field doesn’t show anything [closed]

still don’t know what exactly fixed it. but now it’s all right. i have also found another way to show custom fields: if you want to show a specific field in a specific place, in the CartListDisplayer.php, add to the function lcp_build_post anywhere you like: $lcp_display_output .= get_post_meta($single->ID, ‘featured’, true); where featured is the name … Read more

associate posts to a page

You can use wp_query with different arguments to list the posts that you want to appear on that specific page (i.e. all the post that are assigned to the X category or all the post that belong to Y author a.s.o). You can find on the WordPress Codex a detailed presentation and examples on how … Read more

Tags and Taxonomy links not working for Custom Post Types

I had to modify queries before they run. So the best practice was to add the following code to function.php: if (!function_exists(‘my_theme_filter’)) { function my_theme_filter( $query ){ if ( $query->is_main_query() ) if ( $query->get( ‘tag’ ) OR is_search() ) $query->set( ‘post_type’, array( ‘artprim_item’ ) ); //echo ‘<pre>’; print_r($query); echo ‘</pre>’; return $query; }} add_filter( ‘pre_get_posts’, … Read more

greater flexibility in targeting images attached to page

Every file that is uploaded in WordPress is an Attachment, which is a kind of post (‘post_type’ => ‘attachment’). When the file is uploaded inside a Post or Page, it is attached to that particular post/page (‘post_parent’ => $post->ID). I can think of a solution that doesn’t involves any particular coding: you simply have to … Read more