Drupal: Different output for first item in a block - drupal

I have a Block created by a View that outputs the 5 latest posts in the sidebar. For each of those nodes, the Block contains the title of the post and the posted date.
Just for the first of those posts I'd like to display more information: taxonomy terms, author name and comment count.
In my View I can send all those fields to the Block, but now I'm wondering: How can I make those fields display JUST for the first post?
The .tpl file that displays this content gets called in a loop, so in there I'm not able to put a counter that tracks whether we're at the first post or post 2 - 5.
What is the best way to go about this?

This is what Views attachments are for. Create an attachment display type with the extra fields and a limit of 1, and attach it to the main view. Give the main view an offset of 1 and you should be all set...

Related

Wordpress custom post type structure

i am building a wordpress website for a client. i need to build 1 template type of page with a list of fields that the client can fill in to populate the page. so lets say i build a template page called Person Template. On it i have an empty picture placeholder on the left and an empty Name Field below that. On the right i have an empty "persons phone number" and "Persons email" field.
what i need to create somehow is a system that the client can enter these 4 items into wp-admin somewhere and save that as a new Person. Then they can repeat and save another Person until they have created say 100 Person pages.
How do I do this? I tried building a Custom Post Type called Person CPT. I have built a Page called Person Template. I have built some "Person CPT" posts and put them on a page but i dont know how to create the Entry Fields page for my client to use.
You're correct that you'll need to use a custom post type. To add the fields you have two options:
Add the fields using add_meta_box(). You'll then need to save this data as post meta. Then in your single-person.php template you would retrieve the meta using get_post_meta(). It's a tad cumbersome, as you need to write the markup for the meta box, hook it into an action to add it to the admin page, and verify the content before it's saved. Here's an article that walks you through it
Alternatively get yourself the Advanced Custom Fields plugin: it makes adding additional fields very quick and easy. I use it all the time.

magic fields 2 // way to emulate write panel?

So Magic Fields 2 doesn't have "write panels." and since MF2 is so sleek - I am thinking there is some other thing that takes it's place that I can't find.
problem is this: creating a simple page with some fields in it.
in MF1//
create some m-Fields
create a page
fill out the fields on the page
select the fields that i want as a write panel.
echo them out on the page
STRUCTURE: page>fields
in MF2//
create a page template
create a page
assign the template to the page
create a custom post type
create the fields for that post type
create a post
fill in all the fields
run a loop in the page for the post type (for 1 post)
echo out the m-Fields data
STRUCTURE: page>post>fields
so a client would have to select the post type "about" then go in there and get(the only post in there) "about" then adjust the fields... meanwhile the page "about" is never touched... seems really strange...
or --- you could put ALL of the magic-fields on "page" - which in my case would mean that there would be 100 plus fields on every page and 90 of them wouldn't have to do with that page and then couldn't be required --- which is all way too confusing for clients.
I feel like I'm just not checking a special box somewhere.
The answer is just NO.
I have since started using Advance Custom Fields plugin and you just set up your custom field sets and tell them what page or post type to appear on. I have more confidence that ACF will stay up to date then the other plug in options. Just wanted to throw that out there.

Taxonomy image in Drupal 7

I've set up taxonomy in Drupal 7 called Colours. I've added some terms (red, blue etc) and added a colour image to each term.
In a content type I have added a term reference field, so my client can choose colours (the colours in which that product is available).
In Views, rather than listing the taxonomy terms on the node page, I would like instead to output the image associated with the taxonomy term.
Any ideas on how to do this? I've tried endless "output this field as" in Views but just can't get it to work. The only way I've actually got it to work is to upload images when adding content, but that's not ideal obviously.
In Drupal 7 you have to add the taxonomy under "relationships". Then the taxonomy images will appear as fields in the view.
I had the same issue, all I did was adding a new field called "image" to the taxonomy and inside the view I just called that field. its working well.
Your best bet is to create a View Template, and in the template you can look at the value in that field and load the appropriate image in its place.
Here's a guide on doing this in Views 2: http://www.group42.ca/theming_views_2_the_basics
Couldn't find one for Views 3

How to assign view block to dynamic taxonomy term page for CCK entries

http://localhost/rkk/work-type/non-profit
I created a vocabulary and terms under for work-type. and I created some posts...
Then I created a View Block to list my entries, and assigned to a page... everything fine so far.
I display the work-type at entry details page. and I have a link "click to see other non-profit(assigned work type) works". When I click this link, it lists entries assigned to that particular work-type. thats fine, but it displays title/body/readmorelink :/ I need custom view for this page, like I did View Block for listing all posts...
Can I assign custom created View Block to this taxonomy entry list page? the url changes according to work-type, so how do I assign view to changing-url :/
Appreciate helps!! thanks a lot!
UPDATE FOR MORE INFO:
I have a vocabulary (work type), and terms under (corporate, non-profit, etc...)
I have a CCK for "work", and as a field I have select terms of work-type vocabulary.
I have a Custom Views Block to display works in a page (thumb, title, desc, link, etc.).
When I click a work, it goes to particular Work entry details page, I place a link in there "click to see other -term (corporate)- works", etc.
When I click this link, it displays the Work Entries under that particular term. it works fine. but it displays as default look (shown as below), but I need this page same as main works page list (thumb, title, desc, link, etc.) I already have a View for this, but how can assign this View to this dynamic url taxonomy page? I found the module http://drupal.org/project/tvi , but cant make it work.
It should be simpler to overwrite term pages with a view, there's already a pre-configured view for this : taxonomy_term (wich is disabled by default)

Changing order of fields in Drupal's content type

I am using Drigg on Drupal 6.17. Drigg has a content type called as "Scoop". I try to change the labels and order of fields. Normally, this is done in Content Management > Content Types > Manage Fields . But some fields that are shown in Create Content screen are not shown in Manage Fields screen.
The screenshot of Manage Fields is here:
The screenshot of Create Content view is here:
The first three fields (Submit the scoop as.., Scoop's URL, Scoop) in Create Content form are not shown in Manage Fields view.
I would like to ask the reason for this. They must be defined somewhere else. Where is it?
Manage fields is for editing CCK fields that you have added. Other fields from different modules often have a weight setting that you can change to move the field up and down, which you would get to from the main content type editing page.

Resources