saednashef
Forum Replies Created
-
Forum: Plugins
In reply to: [Custom Content Shortcode] How to display taxonomy links?I got this working by hacking the [pass] shortcode to allow passing a FIELD with current post id.
In the pass_shortcode function in ccs-loop.php file, right under this line of code
$field_value = get_post_meta( $post_id, $field, true );
I added the following:if ($field == 'currentpostid') { $field_value = get_the_id(); }I then modified the above CCS shortcode block as follows:
[pass field="currentpostid"] [loop type="post" id="{FIELD}"] [for each="founders"] <a href="[url]/founders/[each slug]"> [each name] </a> [/for] [/loop] [/pass]I’m sure there’s a better way to do this, but for a temp hack, this works.
Hope this helps.
-saed
Forum: Plugins
In reply to: [Custom Content Shortcode] How to display taxonomy links?Eliot, I just saw this (was away), and it is great. thanks!
The code you provided displays “founders” for all posts. Anyway to limit this only to currently displayed post? I saw that you have a ID parameter to filter on post id, but couldn’t figure the syntax to use with a post id shortcode. Is there a better way to do this?
here’s what i tried
[loop type="post" id="post_id"] [for each="founders"] <a href="[url]/founders/[each slug]"> [each name] </a> [/for] [/loop]Forum: Plugins
In reply to: [Custom Content Shortcode] How to display taxonomy links?Eliot,
Thanks for your response. I thought of trying something similar to what you’ve suggested, and it works so long as you have one tag on the post for a specific taxonomy. But for a post that is tagged with two “founders” (for instance bill gates & steve jobs), the generated html looks like this:
<a href="http://mysite.com/founders/bill-gates steve-jobs"> Bill Gates, Steve Jobs </a>Any ideas on how I can generate a link for each tag?
Cheers,
-saed