apply rel="nofollow" to field in drupal 7 - drupal

I have content type with name "Product" and there is field name Remote product link and field type is link.
I want to set rel="nofollow" for this field. I am new to drupal and I am stuck here.
Can anyone please help me on this?
Thanks in advance.

You can have specific field and node templates for your field / content type.
Checkout on template naming conventions i.e. here:
https://www.drupal.org/docs/7/theming/template-theme-hook-suggestions
So you should find original (core) template, copy it to your theme, but name it by following those conventions (you are overriding core templates that way) and clear drupal cache so drupal will start using it.
You can override just a field template (i.e. field--field-name.tpl.php) , but you can also override whole node template (i.e. node--product.tpl.php) and from it print field by field, the way you like.

Related

Get custom field on Contact Form 7 (with underscore)

I am trying to fill a field on the form with post_meta as explained in the documentation.
This custom field “edit_last” is working:
[text* edit_last default:post_meta]
But when the custom field starts with underscore, its not workin “_edit_last”:
[text* _edit_last default:post_meta]
How can I display custom fields that are starting with “_” (underscore).
My wordpress theme is generating some custom fields starting with underscore and I need to display some of them on the form.
i have the same issue and i now solved it with another plugin (sorryyy)
with this plugin you can write
[dynamichidden hidden-lotid "CF7_get_custom_field key='_sku'"]
to get custom field including hidden custom fields (custom fields starting with an underscore are considered hidden fields and will not be displayed in the edit pages).
sorry for this lousy answer, i usually do not recommend plugins and i certainly do not recommend contact form 7, i regret using it each and everytime i touch it.

How to see field names of a view in Drupal 7?

How can I find the name of a certain field in my Drupal 7 view? For example I'm trying to find the event date field name in this view so that I can use it in my template file.
Thanks.
You can hover over the field name on the view edit page and you will get the field machine name at the bottom left corner of your browser screen.
But what you should really do in my opinion is download and enable the Devel module and add dsm($fields); in your template that will output all the fields available and their structure.

Wordpress getting template for post category type to work

Hiall,
In my wordpress site I have a Category called “meetings”, and it’s slug is “meeting”, also its ID is 27.
I create a default post article and then select “Meeting” from the categories panel and then publish etc.
Reading here
http://codex.wordpress.org/Template_Hierarchy#Custom_Taxonomies_display
If I create a template file called category-meetings.php or category-27.php then it should pick those files up and use them for a template layout for my selected Meeting category posts etc???
But for whatever reason I can not get it to do this.
I have also tried changing the permalinks settings from “post name” to custom structre with /%category%/%postname%/
but again no luck.
Am I missing something here?
Any help would be great!
I think you're trying to target a single post, whereas your template is targeting the category archive pages. For example, look at this diagram of the template hierarchy.
You could:
1) Create that post as a page and then create a template just for that page.
2) Create a custom post type and create a custom template for that custom post type.
The naming has to match your slug. I would change
category-meetings.php
to
category-meeting.php
And make sure the category-customname.php files are in the same directory as the default category.php file.
Addition/Revision
For a custom page for a single post -- find the post number, let's say 999, then create a single page with the past number appended to the file name in the same directory where the single.php file exists. This worked up to WP ver 3.2-ish. Unless it's been deprecated, it should still work.
single-999.php

wordpress duplicate the custom post type

I have made a template custom type with custom field. What I need to do is make a copy of that post so that all the data and custom field could be copied to new custom post type. So that I could change the certain part of that project.
Might be some plugin m looking for.
there is a plugin for dublicating the post types
please check the link here the plugin http://wordpress.org/extend/plugins/duplicate-post/. it provides a clone option on the list where quick edit resides

Customize the way CCK Node Reference fields are displayed in Drupal

Node reference fields in Drupal are displayed as lists by default. Is there a way to change that?
I'd like to output them as JSON so I can create a fancy JavaScript visualization.
You can modify it in 2 ways: via custom module with function hook_form_alter or via theming (preprocessing form or templating form).
http://api.drupal.org/api/function/hook_form_alter/6
http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6
For AHAH: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#ahah
Also, nodereference already have little ahah: "autocomplete" in field editing of custom node type.
Consider the Content Templates (Contemplate) module. Here is a quote about it (from the module's project page):
... allows modification of Drupal's teaser and body fields using administrator defined templates. These templates use PHP code and all of the node object variables are available for use in the template. An example node object is displayed and it is as simple as clicking on its properties to add them to the current template.
This module was written to solve a need with the Content Construction Kit (CCK), where it had a tendency toward outputting content in a not-very-pretty way. And as such, it dovetails nicely with CCK, adding a "template" tab to CCK content-type editing pages and pre-populating the templates with CCK's default layout. This makes it easy to rearrange fields, output different fields for teaser and body, remove the field title headers, output fields wrapped for use with tabs.module (part of JSTools), or anything you need.
But Content Template can actually be used on any node type and allows modification of the teaser and body properties before they go out in an RSS feed, search index, or are handed off to the theme. Additionally, ConTemplate can choose to add any files, images, or other media to RSS feeds as an attachment.
Templates are normally stored in the database but it is also possible to create disk-based templates which live in your sites directory and can be inherited across multisite installations in the same way as themes or modules.
Try the Custom Formatters module, simply make a custom formatter to render the node out exactly how you want it, then output the formatter to code or to a Feature for deployment.

Resources