How to show posts of certain label or category in a row in my blogger home page? - responsive-design

I want to first include latest posts in my blog home page and then I want to create a row containing posts of a certain label. I want to display different rows of different labels.
That's how I want to design my blog. But I don't know how to code blogger so that posts of certain labels are shown in that row.
How do I call them or display them in that row?

I think It's possible! Just need little bit hard work.
First add CSS.
Then search for
<b:include data='post' name='post' />
Now replace this code with this one -
<b:if cond='data:blog.url == data:blog.homepageUrl'> <b:loop values='data:post.labels' var='label'><b:if cond='data:label.isLast == "true"'>
<b:if cond='data:label.name != "Your First Label Name"'><div class='row'><b:include data='post' name='post' /></div></b:if>
<b:if cond='data:label.name != "Your Second Label Name"'><div class='row'><b:include data='post' name='post' /></div></b:if>
<b:if cond='data:label.name != "Your Third Label Name"'><div class='row'> <b:include data='post' name='post' /></div></b:if>
</b:if></b:loop><b:else/><b:include data='post' name='post' /></b:if>
Note: you should remember that every post should have one label. And don't forget to add class='column' in article.
I don't try it. Check it by yourself and give me feedback.

Related

How to show recently record list on my custom visualforce page?

The sObject's record list
Hey, I have a question, when I click a sObject's tab it will present a standard page. The picture shows the recently record list, is it a standard function like "apex:listViews" mark-up tag? I want to achieve this function in my own custom page. How do I do this?
I don't think there's a dedicated VF tag for it (aside from some very specialised cases like Knowledge and Ideas-related tags). But you can manually query it from database and display in <apex:pageBlockTable>.
There's a table with "recently viewed everything, across all objects" (think of it like "Recent Items" sidebar in clasic SF UI): https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_recentlyviewed.htm
And also most objects will have a LastViewedDate field so you should be able to do
SELECT Name
FROM Restaurant__c
WHERE LastViewedDate != null
ORDER BY LastViewedDate DESC

Drupal 7: How do I extract specific field in a taxonomy page

How do I extract specific field for display in a taxonomy page?
I have a custom content type called "film" and each film has a Term Reference field called "casting". As expected I can click on a "casting" (tag) it brings me a page where all films are listed wherever this tag is associated. For expample if I click on "Kate Winslet" from movie Titanic, I land on a page http://localhost/mysite/tags/kate-winslet where other movies of Kate Winslet are listed. Up to this point everything is just fine.
I do not want Drupal to pull in and show default fields like just Title and Body in its own display format. Rather I want it so that I can display a photo from each film, year of release and of course the title and trimmed version of the body. I only want to customize the content of this page so that I have the control over What to Show and Where To Show a specific field value.
This is what I tried:
I cloned and put page.tpl.php in my theme's template folder. Renamed it as page--vocabulary--tags.tpl.php. Then I took out the following line of code (<?php print render($page['content']);?>) from my page--vocabulary--tags.tpl.php. The intention was to check whether the overridden template is actually being accessed by Drupal or not. It does!
But I am not been able to extract fields like field_photo or field_release_date from $page['content]. To get an idea about defined variables and how they are placed I used the following line of code:
<pre><?php /*print var_export(get_defined_vars(), TRUE);*/ ?></pre>. But even from there I could not extract a particular field like I mentioned above. The fields look to be somewhere inside $page['content']['system_main']['nodes'], but I don't know how to get to a specific field directly.
I also created a template.php with the following preprocess hook function:
<?php
function introduction_preprocess_page(&$vars) {
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$term = taxonomy_term_load(arg(2));
$vars['theme_hook_suggestions'][] = 'page__vocabulary__' . $term->vocabulary_machine_name;
$vars['content'] = $vars['page']['content']['system_main']['nodes'];
}
}
?>
Both <?php print render($content) ?> and <?php print render($page['content']) ?> print the same result but I want something like <?php render($content['photo_field'])?> which I am not been able to.
I am sorry for making this too long. I have just stepped into Drupal. So wanted to make sure that what I am trying to explain matches exactly what I want to accomplish.
You are probably trying the long way to this.
You can use Views module. It allows to create custom listings querying the database, but also override existent ones, like the case of the taxonomy term page listing.
Once you have the module installed (if it's not yet), particularly the Views UI module, go to /admin/structure/views and scroll to bottom, where disabled views (grayed rows) are. You'll find one called Taxonomy term, described as 'A view to emulate Drupal core's handling of taxonomy/term.'
Click Enable on the right of it and then go to the same place where the Enable link is, click the arrow to unfold and choose Edit.
Once you're in the view edit page, you can manipulate the listing at your convenience, adding/removing fields or whatever you want to do in your particular case. If you are not familiar with Views, I recommend you to learn about it, there is a lot of related content on the web and it is close to essential for Drupal development.
Also, if you want to add more customisation to the page, you can use the same approach with the Panels module, who allows to override system pages (not just listings like Views).

Changing order of fields in Drupal's blog

I am using Drupal 7 and Zircon template. I am trying to change the order of fields of my blog. Basically, my blog shows (in front page):
Title
Date/Time
Body
Link to "Read more"
I created some categories using taxonomy and I want to show this category before the title.
In "Manage Display" from "Administration » Structure » Content types » Blog entry" I can just put the category after or before the Body field. I think I will need to change something in the code, but I don't know where. I found the file "field--taxonomy-term-reference.tpl.php" where I can customise some information about category, but not where it will appear.
Does anybody knows how can I do it?
Use Panels module else with coding you can override node template.
Cheers!!!

Drupal 7: Feeds doesn't assign feed items to organic group

I installed "Organic Groups" and "Feeds". I have 2 content type (feeds and articles).
Feeds works fine, it imports the items well.
I assign feeds and articles content to a group (both have group reference field), but when I import with Feeds, the items doesn't have group reference.
I tried to configure the importer, but I can not map the reference group.
Any idea? Thanks ^^
(Sorry for my english)
I know this is an old post, but I think I have a solution (I had a similar experience earlier). It's a little complicated, but it definitely works!
Install both [Feeds] (https://www.drupal.org/project/feeds) and [Feeds Tamper] (https://www.drupal.org/project/feeds_tamper)
Create a content type to receive the feed entries.
*I'll call this new content type "Blog post"
Add a text field to BOTH the new content type AND to your OG form.
*I'll call this field "Feed nickname"
On your OG form, fill in the field with the appropriate feed nickname.
*I suggest making this a one-word nickname
Under Structure>Feeds Importers>Edit>Node processor settings, select "Blog post" as the chosen bundle to receive the feed. Click save.
Under Structure>Feeds Importers>Edit>Node processor mapping, add a new mapping with "Blank source" as the source and "Feed nickname" as the target. Click save.
Under Structure>Feeds Importers>Tamper, scroll to the section "Blank source-> Feed nickname" and click "add plugin."
Choose the plugin called "Set default value" and set the default value to your chosen feed nickname. Click save and make sure the plugin is enabled. Click save at the bottom of the tamper form.
Add the feed importer as usual, under yoursite.org/import
Short explanation:
What this process does, essentially, is to assign all of the incoming feeds a default dummy value (in this case, the "feed nickname" you chose), and then match that value to the one you put in your content type. Having the same field and field value shared among the feed, the content type, and the OG links them together, and makes it possible for you to relate them in Views, etc.
Hope this helps!

Change the full title on a single page (Drupal)

I need to change the title of a single page within a Drupal site.
Right now I have it set up so that in hook_preprocess_page I'm calling drupal_set_title(). That's fine, except that it leaves the site name in the title. How can I change the complete title, site name and all? I don't want the site name to appear on this one page.
i think you can change the title by use
drupal_set_title(check_plain($node->title));
may be this module help you
"Page Title"

Resources