Forum Replies Created

Viewing 15 replies - 331 through 345 (of 1,041 total)
  • you are using $inp[0] instead of $inp in the following line:

    $inp[0] = wp_kses($inp[0], $allowed, $prot);

    I found this thread while trying to accomplish the same thing. Here’s the solution that I came up with for a blog running WordPress 2.9.2 that has the taxonomy Artist Type defined only for Pages. I needed to query all pages that had a term of this taxonomy associated to them. Here’s what I did:

    $artist_ids = array();
    $artists = $wpdb->get_results( "
    	SELECT p.*
    	FROM $wpdb->posts AS p, $wpdb->term_taxonomy as tt, $wpdb->term_relationships as tr
    	WHERE tt.taxonomy = 'artist-type'
    	AND tt.term_taxonomy_id = tr.term_taxonomy_id
    	AND tr.object_id = p.ID
    	AND p.post_type = 'page'
    	AND p.post_status = 'publish'
    	ORDER BY p.menu_order ASC
    	" );
    
    if ( $artists ) {
    	/* Create an array filled with the ids of all artist posts. */
    	foreach( $artists as $artist )
    		$artist_ids[] = $artist->ID;
    
    	/* Make sure the postmeta is cached. */
    	if( !empty( $artist_ids ) )
    		update_meta_cache( 'post', $artist_ids );
    
    	/* Loop over artists */
    	foreach( $artist_pages as $post ) {
    		setup_postdata( $post );
    		#Do wordpress loop stuff here.
    	}
    }

    I know using custom queries is not really the best practice, but I also don’t see the database structure change very much either.

    Hope someone finds this useful.

    I can verify that this fix also works in WordPress version 2.9.2 – just don’t forget the semicolon on the second require_once() 🙂

    Thread Starter Michael Fields

    (@mfields)

    thanks for answering, my biggest problem that when going to this page i get a 404 (the code to present the terms i have) I just dont understand what’s the equivalent of archive.php for that matter, or how u assign this url to go to the specific page u want.

    Totally understand you. The issue here is that there is no resource at that address. Please bear in mind that archive.php only comes into play when you are viewing the terms of any given taxonomy including categories and tags. Give it a try (depending on your permalink structure) http://example.com/category/ or http://example.com/tag/. Each of these addresses should also produce a 404 message. archive.php is only evoked in a situation like http://example.com/category/my-category/

    did u create an actual page in the admin (under “pages”) and set its name to “Clients” and its permalink to .com/clients/ or you took a different approach?

    Yep, you got it!

    I’m looking for a dynamic scalable solution that would not require me to create a page per taxonomy..

    I wish there was an easy answer that I could give you in regards to this. This functionality is not supported by core and I yet yet to stumble upon a solution – other than creating a page for each taxonomy.

    Unfortunately, I do not have time at present to work out some code for you… but definitely plan to revisit this thread in the next couple of weeks… hopefully someone else can piece together a fast solution.

    Best wishes,
    -Mike

    Thread Starter Michael Fields

    (@mfields)

    obvio,

    The section at /clients/ is a page that I have set up to specifically display all terms of the “Clients” taxonomy. On this page I am using the Taxonomy List Shortcode – a plugin which you can find here:

    http://ww.wp.xz.cn/extend/plugins/taxonomy-list-shortcode/

    This code will display a list of all terms of a given taxonomy that have images associated to them via the plugin. Please change the second argument of get_the_terms() to the value of the slug of your custom taxonomy.

    $terms = get_the_terms( $post->ID, 'my-custom-taxonomy-slug' );
    if ( $terms ) {
    	foreach( $terms as $t ) {
    		$url = get_term_link( $t->name, $t->taxonomy );
    		$img = $taxonomy_images_plugin->get_image_html( 'detail', $t->term_taxonomy_id );
    		if( !empty( $img ) )
    			print '<a title="' . $t->name . '" href="' . $url . '">' . $img . '</a>';
    	}
    }

    The following code should produce the results you are looking for:

    $post_tags = get_the_tags();
    if ( $post_tags ) {
    	foreach( $post_tags as $t ) {
    		$url = get_term_link( $t->name, $t->taxonomy );
    		$img = $taxonomy_images_plugin->get_image_html( 'detail', $t->term_taxonomy_id );
    		if( !empty( $img ) )
    			print '<a title="' . $t->name . '" href="' . $url . '">' . $img . '</a>';
    	}
    }

    Best wishes,
    -Mike

    If I were building the site, I would opt for two different categories. Not sure what you mean by subscription… in the event that you mean subscription by rss feed, wordpress will automatically create a feed for each category. Check out the random category feed from my site -> all other categories are excluded.

    http://support.wordpress.com/ is the other forum.

    A couple things could be going on here.

    Have you uploaded any images before you installed the plugin?

    If so, are these the images that are missing?

    Was the image that is displaying uploaded after the plugin was installed?

    The plugin adds a new image size that is 75×75 pixels cropped. Are the images that are not being displayed less than 75×75 pixels?

    eduardozulian & catiakitahara,

    Just waking up here 🙂 Ahhh. The GD Library. Did you get everything sorted out? Just wondering, how did WordPress’s built-in image functionality work? I don’t think that I’m doing anything in the plugin that WordPress doesn’t already do (although I may be mistaken)… did you experience any other issues with the Media Library due to GD not being installed?

    eduardozulian,

    Hi. No problem, it was fun to make! Thanks for writing about this problem… I have not experienced this in my testing but if you could provide the following information, I would be happy to debug the problem and see if I can find a solution.

    1. Your operating system.
    2. Your browser name and version number.
    3. The version of WordPress you installed the plugin on.

    Thanks,
    -Mike

    MFields is ask “why wouldn’t the relative link work for you?” That doesn’t make sense to me. Its storing “http://domiain.com/location/of/file/name.ext&#8221; in the GUID of the media library. Why would you want that to be static?

    Although it may store something like http://domiain.com/location/of/file/name.ext&#8221; in the guid column of the posts table, I have never seen WordPress core actually use this value for anything. All media links that I have ever seen generated use wp_upload_dir() to generate a string to the uploads directory. Then, a path relative to this directory is concatenated.

    The value of this relative path is stored in the postmeta table under the meta_key of _wp_attached_file (originally uploaded file) or under _wp_attachment_metadata for intermediate image sizes.

    On another note: When you talk about importing and exporting, are you referring to sql or WordPress XML? I have experienced much success using WordPress’ built in importer/exporter. As for links in the post content, you might want to try a plugin such as:

    http://ww.wp.xz.cn/extend/plugins/search-and-replace/

    Never used it before but it might help ease the pain of migration.

    No problem… whenever you’re doing something like this just remember that get_bloginfo() returns a value while bloginfo() prints a value. They both accept exactly the same arguments.

    Adding the following function to your themes’ functions.php file should do the trick:

    add_filter( 'the_content', 'mfields_trim_teaser' );
    if( !function_exists( 'mfields_trim_teaser' ) ) {
    	function mfields_trim_teaser( $content ) {
    		if ( is_single() && preg_match( '/<span id="more-(.*?)?">/', $content, $matches ) ) {
    			$parts = explode( $matches[0], $content, 2 );
    			if( isset( $parts[1] ) && !empty( $parts[1]	 ) )
    				$content = $parts[1];
    		}
    		return $content;
    	}
    }
Viewing 15 replies - 331 through 345 (of 1,041 total)