omega theme, file node--type.tpl.php - drupal

I'm using the theme of Omega 3. I would like to review the layout of certain fields inside my content type "video". I made so the file: node--video.tpl.php:
<? php print render ($ content ['body']); ?>
yet even this simple statement does not work. Does anyone know the reason? No review of the design of the node with omega 3?

for better debugging, try to install devel module and theme developer module.
Both can be your best friends till you solve this issue.
Hope this helps... Muhammad.

I understand why it did not work. Going up: structure -> content type -> manage display, the fields that I want to print with php hidden. Putting them visible both on the "teaser" that the "default" everything works as it should.

Related

content area not found in my page with elementor

I just started with Wordpress and I published a website a few weeks ago. Today I wanted to edit the homepage, but I get the following error:
Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page.
I haven't edited my homepage and it worked perfectly a couple of weeks ago. Is there someone that can help me fix this issue?
If you are using any shortcode on your page and you are fetching post on that page and looping through the post in a while loop. Please add this after the loop ends. No sure why but this always cause issue for me.
wp_reset_postdata();
Code will look like this:
$posts= new WP_Query($args);
while ($posts->have_posts() ) : $posts->the_post();
.....
.....
.....
endwhile;
wp_reset_postdata();
It doesn't matter it's a shortcode or what if we are doing something like above make sure to add wp_reset_postdata();
This is one of the issues that I usually face. There can be other reasons too.
Probably you've edited the page template from Templates -> Theme Builder -> Single. Anyway, even if you don't, you can fix it that way: Go to Templates -> Theme Builder -> Single -> Add New, then select page and create a template for all single pages (make sure that you drag the page content widget in the template). This should overwrite your theme single page template (which misses the content function).
Just make sure your 'Home Page' and 'Posts Page' are different, otherwise you get your page mixed up and this error occurs.. Worked for me!
You can verify this setting in Appearance>Customize>Homepage Settings :)
The Answer to this error is to check the structure of your permalinks. Try to save your permalinks one more time. Also, try to change the permalink structure to “Plain”. Some servers do not allow to write to the .htaccess file and as a matter of fact, you cannot always modify your permalink structure and edit with Elementor.
I found myself in the same place yesterday and freaked for a moment and did some research to find out why I was receiving the error and came across this page. Believe for me it occurred due to the situation Ed Jones posted about above, I had inadvertently edited the post template. But a fast and easy fix was to go back to an earlier revision of the page in my history. That solved my problem quickly.
Add the_content() at the end of your templates

Place an Edit Button on the view node page in Drupal 7

I don't use the Drupal Tabs because they interfere with my CSS but I need the functionality of the Edit tab to be on that screen so that a user can edit the node after reviewing it.
Any ideas on how to do this? Functions? tpl placement? Thanks!
You can do this in a custom module as follows.
In yourcustommodule.module you implement hook_preprocess_node(). In there you check if the user has permissions to edit the node and you set the edit link.
function yourcustommodule_preprocess_node(&$vars) {
if (node_access("update", $vars['node']) === TRUE) {
$vars['edit_link']['#markup'] = l(t('Edit'), 'node/' . $vars['nid'] . '/edit');
}
}
In the node.tpl.php template in the theme you print the edit link if it is available.
<?php if (isset($edit_link)) : ?>
<p><?php print render($edit_link); ?></p>
<?php endif; ?>
If you do not have a node.tpl.php template in your theme folder than copy the one from modules/node.
If you're using the Views Format "Fields", one of the fields that you can add is "Edit Link." It's pretty flexible; it will tell you what text to display in the link. That's probably the preferred option.
If you're not using the "Fields" format, it gets trickier, especially since you're already interfering with some basic drupal styling. I'd need more information about your View and your skill set to recommend a method that doesn't cause more problems.
As a sidenote: I learned Drupal theming from the outside in, and used to use CSS that would interfere with the underlying drupal mechanics like tabs and contextual links. I've moved away from that; I find very few cases where I need to interfere with native styling-- and for those I can use custom .tpl's to get around.
EDIT: Ah. If you're not using views, a custom page .tpl is probably the best way to go. If you're not familiar, the structure for any node edit link is '/node/<NID>/edit' (for clean URL's) or '/?q=node/<NID>/edit' for old-style URL's. Depending on how your path aliases are set up, '/<url-alias>/edit' may work as well but the previous ones are more reliable.
This link on drupal.org gives a few options.
I think u can write a theme file(.tpl) for u specific case and theme page in whichever way u want

Drupal 7 How to override page.tpl for specific content type?

I wanted to override page.tpl.php for specific content type.
I have tried these thing, nothing works for me.
page--article.tpl.php
page--node--article.tpl.php
page--node--type--article.tpl.php
page--node-type--article.tpl.php
page--type--article.tpl.php
But when I targetted specific node by number i.e. page--node--8.tpl.php it worked fine.
I think page--article.tpl.php should have worked, but I dont know why its not working.
Please tell me if I am naming it wrong. and how can I debug such things. I have heard I can use Devel module, but know nothing about it. A slight hint in right direction will be appreciated.
Thanks in advance
You have to make sure that your template can handle this ... I got a code snippet that worked for me here:
http://drupal.org/node/1089656#comment-4426790
<?php
function themeName_preprocess_page(&$vars, $hook) {
if (isset($vars['node'])) {
// If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php".
$vars['theme_hook_suggestions'][] = 'page__'. $vars['node']->type;
}
}
?>
Have you remembered to clear the cache (under Administer > Site configuration > Performance) so that Drupal is 'aware' of your new file & uses this rather than the default.
See here on Clearing cached data
Also, you may need to add a preprocess hook (I haven't used D7 myself, just 5/6 — think this has changed slightly.) This post on Drupal Stack Exchange seems to give more details
I just ran into the same problem.
node--recipe.tpl.php
not
page--recipe.tpl.php
this is, of course, with a content type called 'recipe'.
ALWAYS CLEAR THE CACHE...
Go to /admin/config/development/performance and click the clear cache button. It should be the first thing you do if you've made alterations to the structure of the backend and they're not showing as expected.
Otherwise you almost had it right
page--content-type-name.tpl.php
will allow you to theme the content type template.
I know this is an old question but if others arrive here, the way I override content types in drupal 7 is like this
node--contenttype.tpl
You will need to overwrite the specific node template for the content type if it is anything different than a Basic Page. Please check this out:
http://api.drupal.org/node/19080
Under this page copy/paste the items that are in the node.tpl.php page and overwrite it on how you want. You can access the node specifically by $node
Your template for articles would be:
node--article.tpl.php
Once this is created make sure you clear cache to ensure this works.
So depending on what you are trying to accomplish, there might be some CSS tricks that could help you out.
For instance, to override any CSS rules for a specific node type just remember that your pages for that node type will have a body class of "node-type-[TYPE]" (ie: .node-type-article)
You can then override the CSS as follows:
body.node-type-article #selector {}
Step 1.create a content type for example: my content type is "fullwidthpage"
Step 2. copy page.tpl.php and rename to page--fullwidthpage.tpl in template folder.
Step 3. Add this code to template.php
function <strong>YOUR_THEME_NAME_HERE</strong>_preprocess_page(&$variables) {
if (isset($variables['node']->type)) {
// If the content type's machine name is "my_machine_name" the file
// name will be "page--my-machine-name.tpl.php".
$variables['theme_hook_suggestions'][] = 'page__' . $variables['node']->type;
}
}
Don't forgot to change YOUR_THEME_NAME_HERE

Adding A Button Between post-content and Related Posts Thumbnail Plugin on WordPress

I am trying to add a button to my WordPress template. Basically, I have the post and then there is the Related Posts Thumbnails widget that appears. I want the button to go between the text of the post and the related posts thumbnail widget. The code in my 'Single Post' that contains all of this is as follows:
<div class="post-content">
<?php the_content(__('<em><strong>More:</strong> Read the rest of this entry...</em>', 'life-is-simple')); ?>
</div>
I know the Related Posts Thumbnails plugin falls within this code because it's at that place when I 'Inspect Element' on Google Chrome. I can't find how to edit the order of things within that div though. Any help would be greatly appreciated, thanks!
EDIT
Clarification: I am using the Life Is Simple WordPress theme although it has been custom editing quite a bit (mostly on the CSS side of things though).
That plugin is probably appending the output to the_content with a filter .
That means , that the output is being added to the_content automatically. it is a common behaviour.
You need to look at the plugin´s admin interface to see if you can have an alternative way (I believe there is ) which is using a template tag. in that case, you should put the template tag after the div where the the_content() is .
EDIT I :
After a small dig, - in fact there is - you need to put
<?php get_related_posts_thumbnails(); ?>
Then the plugin should know by itself not to append to the_content.
For parameter passing, or if something is not working, go read their APi or help files.
You'll probably need to edit single.php or archive.php in your theme. If nothing is occuring there that looks familiar, it's probably using a loop. In which case you might find what you are looking for either in loop.php, loop-single.php, or loop-archive.php depending on what type of page you are on and how the theme was constructed. Add your button near where you find Read the rest of this entry...
With more information (such as what theme you are using), one might be able to help more as well.

how come the wordpress admin bar isn't being displayed properly?

i just upgraded to wordpress 3.3 and built a really basic template for some reason the wordpress admin bar on the site is displaying really weird. on the backend (dashboard) it is fine though.
i have attached an image, but is there a better way to view my problem? or has anyone else had it?
http://www.keganquimby.com/dev/
it wont let me upload an image, so to see my screen shot: http://www.keganquimby.com/dev/wp-content/uploads/2011/12/Screen-Shot-2011-12-15-at-3.07.29-PM.png
I didn't know you could actually disable the admin bar for the front end of your site altogether, which is what I needed. Clicking on users then toggling the "Show Toolbar when viewing site" option off did it!
If you have already included wp_head(); & wp_footer();
Check function.php for show_admin_bar(FALSE); and change it to show_admin_bar(TRUE);
Have you made sure that your header.php contains the wp_head(); function call as last line of your head container and that you have wp_footer(); as the last line of your body container?
It's hard to diagnose the issue since your error probably lies server-side (PHP code).

Resources