Drupal 7 node object in front page missing - drupal

i just started using drupal and here is a thing which i simply dont understand. so im writing my own theme derived from the default themes. i enabled the image module to also have featured images for basic pages - so far so good. now in template.php i use the preprocess_page hook to get the image to put into a sort of banner above the page content but .. the node object is not in the first parameter (of the function= but only for the front page?! on all other pages i see the node object. can somebody explain that to me maybe? or does this sound like some self produced thing. i tested the bartik theme and i could reproduce this behavior so i wonder why
thanks

Related

Wordpress template assignment not working as expected

Whilst risking duplicating another post, I think this may be unique as other similar posts I've read haven't given me an answer that works for me. I have spent hours going through answers in other posts to no avail. I feel like what I've done should be working, but for some reason isn't.
I am new to Wordpress (but not development in general), and have set up a custom theme and page template (called index-gallery.php based on index.php and modified slightly to pull out my custom gallery posts). I have assigned that template using the page template dropdown on the right hand side of the page edit screen (using the remarked template name 'gallery page' that shows up fine in the list). So, you'd expect that to over-ride the standard hierarchy settings. However it isn't being applied and I'm seeing the index.php template being used. However, if I change the parent page of my 'gallery' page to be the home page it suddenly uses the 'index-gallery.php' template and the template works exactly as I'd expect. So I know it's not an issue with the template itself, as it works in that instance. I'm using 'what the file' plugin to see what templates are being used. I've tried re-assigning the slug in the page edit and re-setting permalinks etc, but that hasn't solved it.
Does anyone know what may be getting in the way of the template assignment when it's not parented to the home page? I don't really want it parented in that way.
This is all set up on my localhost running on xampp using Wordpress 4.9.7
You should rename your template files to something else (that doesn't begin with one of the standard WP template file names) - such as template-gallery.php
Oh, and you might find it better to base page templates on the page.php file anyway.

Created a drupal theme, but now I can't login?

I'm new to drupal so please explain like I'm 5 years old.
I created a new theme for my drupal 7 setup. It consists of the info file and a page.tpl.php
Inside page.tlp.php I have literally placed hello, this is my theme. Nothing else.
I enabled the theme and disabled all the others, I made my theme the default.
So as expected the homepage returns my text. However, I had assumed that going to http://mysite.com/?q=user would show me some sort of default login. Apparently not? There is no login form and it only shows hello, this is my theme
I think my assumption that the login form would always be there was incorrect. Do I have to code this into my theme?
What would be a simple way to do this, if at all?
Thank you for your patience with my newbie question.
Try to copy things firstly from an existing theme, and modify only some parts of the template pages and see what happens. In page.tpl.php is rendered the whole page like header, footer, sidebar first where the login form is usually, sidebar second, etc.. that's why login form does not appear.
Change setting.php to previous if you have made any changes in it for this theme (and archive your present setting.php).
Delete your fold with this theme from fold THEMES.
http://mysite.com/?q=user (http://mysite.com/user)
Login.
Change theme to correct one.

Wordpress: How to administrate Background-Image and Content Slide

I am about to build a Wordpress theme for a non-blog website. I am familiar with the basic post/page concept and I used to set a static page being the front page.
Now I want the fron-page to change *its background image* and a little part of its content every few seconds (Here is an example of what I am trying to achieve.)
I already know how to develop the javascript and HTML part of that! I would like to know how to make those changeable items (background-image as well as the small content) to be managable in the Wordpress admin area (Since that's the whole point o a cms, right :-)).
How would you do that? Is there a plugin to connect custom contents like that? Or do I have to build my own plugin? I would appreciate your thoughts :-)
The rough steps to take:
Create a custom posttype
In the supports option enable thumbnail
Create a few posts with a featured image (and other data you want)
Fetch your posts using WP_Query
Loop your posts.
Do JS magic.
questions? ask.

Drupal 7 Views - Node Content Not Appearing

I have an issue in Drupal with getting node content to display itself. I suspect it could have to with the CSS styling, although I'm not 100% sure what's causing the issue.
Background:
So basically I'm trying to setup a blog but I'm running into serious issues trying to simply get the blog posts to display themselves.
I created a custom Drupal 7 theme using the export function of Artisteer (http://www.artisteer.com/?p=overview). A stylesheet called style.css was generated. I put some of my own CSS into this stylesheet along with the parts that were auto-generated. I should mention I did some amount of custom CSS to force the homepage to look the way I wanted.
I followed the instructions from the PDF at (http://learnbythedrop.com/buildingyourblog) to create a blog (great easy-to-follow guide). The most relevant pages for Views are pages 34 - 36, where he takes you through how to create a "Blog Post" view, in order to display your blog content correctly. However, when I got to the point where he created sample blog content and it displayed it's title and main content, this simply didn't work for me. See this link for example (Sample content that I created for testing purposes):
(http://www.productworld.com/blog-posts/2012/06/08/hello)
I can see a list of titles for sample content that I created (under the Recent Posts block), but I can't view any content from the individual blog posts themselves. The page is just blank.
Also, I can't see a list of the titles and teaser links - it should show up under (http://www.productworld.com/blog-posts) but that URL gives me a "page not found" error. This was something that worked in a previous iteration but now does not work.
Here are 2 screenshots of my View settings, in case it's relevant:
http://i.imgur.com/uadew.png
http://i.imgur.com/9yOUk.png
Questions:
What is the likely cause of the blog content not displaying? (If I do a preview of the blog post within the Views section I can see the blog content just fine, it just won't display on the actual page.) Is it styling? Some setting in Views? Some Block setting? I've searched my style.css file and tried commenting out everything to do with "content:hidden" and "display:none" to no avail. I've tried every combination of settings in the blog posts View to no avail. I've tried placing "Main Page Content" and "View: Blog Posts" blocks in various regions, and changing around the settings that restrict where the block can be displayed. The blog post title/body content doesn't show up in the page source at all, which could be a clue. How would I go about debugging such a problem?
Why is www.productworld.com/blog-posts saying "page not found", even though I've specifically set up a view to create a page at this URL? And why does www.productworld.com/blog-posts/2012/06/14/hello-world-3 show up as a valid page, when it contains "blog-posts" in it's URL?
Any help would be greatly appreciated. If I should display stuff to do with my stylesheet please let me know.
To me it looks as if you have panels overriding the Node template. Which is why your node is not being displayed properly.
Go to Structure > Panels and see if the Node Template option under Manage pages is enabled. If it is, that's probably your issue. You can tell if it's enabled by looking to the right of the text to see whether it says enable or edit.
You can then edit that setting and then edit the content and choose Node > Body to get the body of the blog post to show correctly.
Take a look at this intro video to panels if you aren't familiar with it. http://yadadrop.com/drupal-video/panels-3-overview
Take the leading '/' character out of your page path for the view - internal Drupal paths should generally never have that, but the system will prepend the configured base path to paths on your behalf (and it is probably already a '/').

How to customize forum nodes components order

I've created for the first time a forum in Drupal. I've added some nodes (posts).
I would like to customize the order of the node components.
For example see this image: http://dl.dropbox.com/u/72686/forum-node.png
I would like to move the "Previous post - Next post" to the top, and move "Login to answer" on the bottom etc..
Is there any Drupal setting to do it, or I should work on the template ? Which is the template for forum nodes ?
Otherwise I can do with a module hook, I know how to change the forms components weight, but I dunno how to change the layout of the nodes.
Thanks
Whenever you want to change to markup (HTML), you generally have to do it with theming. You wont find modules that give you options to move things around. That just too much work, and you can never make every one happy. Instead they set up the module to be overridden and provide a sensible default that most can use.
So with the Drupal theme kit, you generally have 3 options.
Override a theme function.
Override a template.
Create a preprocess function.
In this case, it looks like, there is a master template that organizes the initial post, the answers and the login option. You can find out if this is the case and how the page is created with devel themer. It's a good tool to help find templates and theme functions when you're new to Drupal theming.

Resources