How do I move the tag section below the content in Drupal 6? - drupal

I have enabled taxonomies in the form of Tag, and I would like the tag field to show up below the content when users are editing the page. Where would I make that setting change?

For editing? You don't need code at all, provided you use the CCK module on your site.
Go to Admin > Content Types. Click on "manage fields" on the content type you want to edit, then drag the Taxonomy module form underneath the body. Hit Save, you're done.
For maximum control, you can also use the Content Taxonomy module which turns taxonomies into CCK fields.

You'll need to implement hook_form_alter() within a custom module to adjust the weights of the node edit form fields:
/**
* Implementation of hook_form_alter().
*/
function yourModule_form_alter(&$form, $form_state, $form_id) {
// Is this a node edit form?
if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] .'_node_form' == $form_id) {
// Yes, adjust taxonomy weight to push it to bottom of form
$form['taxonomy']['#weight'] = 42; // TODO: Find appropriate number by inspecting the other form element weights
}
}
Edit: As bmann pointed out in a separate answer, this is not necessary if you have installed the CCK module on your site, as it adds a configuration option for the field order under 'admin > content types > manage fields'.

This is a sample from one of the node.tpl.php files in the themes/ directory.
<div class="taxonomy"><?php print $terms?></div>
If you move that code below
<div class="content"><?php print $content?></div>
It should work.
Assuming I've understood your question correctly!

Related

Drupal: page specific theming without node-id

I am adding a page with a node-id and earlier I was using "page--node--node-id.tpl.php" template to customize the node/page. However, I accidentally deleted that node, and now I am unable to create that node with particular nid node. I want to know how to customize the specific page as each page his unique title.
Use page--node.tpl.php for all the nodes instead of each template otherwise use
node--[node-type].tpl.php for specifc node content type template
There is another smart step to create content type template with your own specific name by following below code
function themeName_preprocess_page(&$vars, $hook) {
if (isset($vars['node'])) {
$vars['theme_hook_suggestions'][] = 'page__'. str_replace('_', '--', $vars['node']->type);
}
}
In above case If node content type is "article" then the template suggestion will be "page--article.tpl.php".
Create template file page--nodetype.tpl.php in your theme directory.

How to hide title from page node Drupal

I'm trying to remove the title of a page node on Drupal. I have this page:
And I want it to look like this:
As you can see, I want the title to be removed, but only for taxonomy terms. If I try to erase it using CSS, I erase al page-titles, so I wanted to use this module, that allows administrators to auto-generate node titles and hide it.
I go to structure -> type content -> my type content, and edit it. I activate the module, and I want to auto-generate titles depending on the node category. I think it should look like this, but it doesn't work...
Any ideas why?
EDIT: Sorry, I forgot to say: yes, when I activate the module, use it, and select the category as the auto-generated title, it works. But it doesn't hide the title...
It also launches this mistake:
Use Exclude Node Title module.
https://drupal.org/project/exclude_node_title
Setting for this module:
Click on Module->Exclude node title->configure
Home » Administration » Configuration » Content authoring
Select All nodes from Basic Page
Check Full Content for hide title from all cms page except home page
Check Teaser for hide title from home page.
If you want to remove the title, you should look into overriding the page and node templates.
page.tpl.php and node.tpl.php
All you need to do is click "View Source" on both of those and copy them to your theme folder. From there you can modify both as required.
From what I can gather, you'll want to remove the print $title from your node.tpl.php.
Have the similar issue before, as far as I remember, I just added some if statement to the code:
<?php if (blah-blah-blah): ?>
<h2> <?php echo $title; ?> </h2>
<?php endif; ?>
Hope, it'll give you a clue.
Some other thoughts: you can make an if statement or rewrite it not only in page.tpl.php but create some specific page-node-type.tpl.php file and overwrite only its $title, or you can try to customize page's output via Views/Panels modules as well.
Also, could you please make more clear, what title do you want to remove? Page title or node title? And it should be removed only when you are looking nodes associated with some taxonomy term (in other words, when you are on /taxonomy/term/n page), am I right?
By using the Context module, you can add classes to the body so you can target just the taxonomy pages in CSS.
Using Context module to set body classes
Sorry guys, it was as easy as hide title tag on "manage presentation"...
You are all right on your responses, but they were not exactly what I needed... thanks!
Use Exclude Node Title module.
https://drupal.org/project/exclude_node_title
another nice solution for specific nodes, is to use the standard $title_prefix/suffix vars, which should be implemented by every theme. using the standard class element-invisible in page preprocess ..
like:
/**
* Implements hook_preprocess_page().
*/
function YOUR_THEME_preprocess_page(&$variables) {
if (isset($variables['node']) && $variables['node']->nid == 1) {
$variables['title_prefix'] = array('#markup' => '<div class="element-invisible">');
$variables['title_suffix'] = array('#markup' => '</div>');
}
}
Every page should contain a heading.
You should always maintain a structured hierarchy of headings within any web page. You should never have a blank heading or even hide it with display:none;. Hiding any content which isn’t viewable by your visitors but is by search engines is against Google’s guidelines as your intention is to only manipulate search engine results by including it. Restyle a H1 so it fits into your design is the best option.
If you still have to hide it then a better option would be to either create a template for that node, content type or page and simply not print the heading.
Or if you want to use CSS then use position:absolute so the heading doesn’t use any space where it is located in the page and text-indent:-9999px; so the text is moved off the screen and no longer visible but at least can be read by screen readers and search engines.
This is how I did it, Switch statement
// Get the name of node
$node_name = node_type_get_name($node);
// Then just add the content types you wish to exclude by overwriting the // $title object with an empty string
switch ($node_name) {
case 'Home page':
$title = '' ;
break;
case 'Event':
$title = '';
break;
case 'Offer':
$title = '';
break;
}

Drupal - Disable listing of nodes on taxonomy term page?

Is it possible to disable the normal taxonomy listing of nodes on taxonomy term pages?
The reason I need this is I want to use a view's override of taxonomy pages BUT the default views override stops a breadcrumb module working properly. So, I want to make a term view but as a block and show it on certain pages with PHP.
Thanks
Another way of doing this is using the Display Suite and Taxonomy Display module. Install them, then go to admin/structure/taxonomy/[mytaxonomy]/display.
Under "Use custom display settings for the following view modes" select "Taxonomy term page".
Then, in the "Taxonomy term page" view mode, under Term page display, select "Associated content display": HIDDEN.
Done! :)
This module claims to do just what you are seeking, but it did not seem to work despite checking the correct taxonomy to disable:
http://drupal.org/project/disable_term_node_listings
But putting the following in your theme's template.php will suppress those node listings:
function MY_THEME_preprocess_page(&$variables) {
if(arg(0) == "taxonomy" && arg(1) == "term") {
$variables['page']['content']['system_main']['nodes'] = null;
}
}
It's sort of a dirty way to do it, and you'll have to hide the pager using CSS, but it works.
This probably isn't the cleanest way but I've made a page-taxonomy.tpl.php and removed this:<?php print $content; ?> So far it seems this solution will work for my site, but I'd still like to know the proper way to do it.
If all you want to do is override the taxonomy term pages with a View, but NOT use the default view, you could create a custom module implementing hook_menu() or you could also take a look at the Taxonomy Redirect module.
From the Taxonomy Redirect page:
This module allows the administrator to change the destination of Taxonomy Term links.

Drupal: Content Type templates

It is possible to choose different templates when I am creating a new node?
For example: When i want to create a node of Content Type Product, i want to choose between 4 different templates.
I have two answers:
1) create a CCK field that the user will choose what template to use, (e.g. field_template), and add this snippet in your template.php:
function mytheme_preprocess_node(&$vars) {
if (!empty($vars['field_template'][0]['value'])) {
array_unshift($vars['template_files'], 'node-' . $vars['field_template'][0]['value']);
}
}
That will then try to use node-template.tpl.php as your template file, and will fallback to node.tpl.php if it doesn't find it.
2) create a Taxonomy for this content type, and design by the taxonomy (something like the code above, only a little modified).

Can WordPress post content be external data (not from the database)

I am trying to display a page based on some data returned from an external API (Amazon). This data is formatted then, has to be displayed on a page, created on the fly, based on URL querys. I can already do this with shortcodes but this has to be from the query.
I see all kinds of info in the codex on returning custom query_posts into the loop from the database. However, I cannot find info getting external data to appear on a page.
Is this possible in WordPress? (anything is possible, right?) Just point me to some functions, filters or tutorials please.
If I understand you correctly, you want to retrieve data dynamically and display it in a WordPress page?
There are many ways to do this, but here's one option:
Create a Page Template
Create a WordPress page and use the Page Template created in step 1.
Edit the Page Template to call the external API and display the data
I'm guessing you've been trying to find a way to do this from the "content" of a page or post, but the easiest way is to put the code in a custom Page Template.
UPDATE: If you want to programmatically create a page, this might work for you: http://wordpress.org/support/topic/how-to-create-pages-programmatically?replies=5#post-1230619
http://www.prelovac.com/vladimir/wordpress-shortcode-snippet-to-display-external-files
This is a snippet to display external data in a post.
Would this help? If the dynamic page was a HTML page and THEM displayed in WP.
Yep, Thats possible.
I Did by using bridges.
You can do it by add "add_meta_boxes" action.
Inside the meta box function you can add call and get the external page contents, or can give your own forms .etc
My Code :
/*
* Add Meta Product Type Field to POST
*/
add_action('add_meta_boxes', 'meta_box_product_type_add');
My Meta Box
/*
* Product Type Meta Box Init
*/
function meta_box_product_type_add()
{
add_meta_box('ptype_testing', 'Product Type', 'add_ptype', 'testing', 'normal', 'high');
}
/*
* Product Type Field
*/
function add_ptype()
{ ?>
<label>Type of Product : </label>
<select name="ptype" id="ptypes">
<option>----Select----</option>
<option>Physical</option>
<option>Virtual</option>
</select>
<label>Unit :</label>
<select name="punit" id="units">
<option>----Select----</option>
<option>KG</option>
<option>Mtr</option>
<option>Ltr</option>
</select>
<?php
}
Try It....

Resources