Drupal Views Issue - php

So we have a drupal site and it is an article intense site.
We have a bunch of articles that are categorized.
On the home page there is a hero slider and 3 thumbnails boxes below it that contain articles as well.
The default logic is that the home slider is pulling the most recent articles posted. The issue is that one of the thumbnails below it pulls the most recent article as well.
How do we make it so that the article that appears in the home hero slider never matches what is in any of the 3 thumbnails below it?
Any help is greatly appreciated!

Under PAGER section of the View, you will find an Offset setting, you could use this to skip some nodes from the second view so it skips the nodes already shown by the first view, of course, in order for this to work, both views need to be using the same sorting logic.
If the criteria for sorting is more complicated or the nodes are manually selected for each section, then you have to use another taxonomy term to "mark" those nodes intended to appear in the Hero section from the nodes somewhere else.

Related

Display group of images from gallery

My problem is two-part..
First, I want to grab images from the WP gallery and display in an unordered list. It is a row of company logos, all evenly sized and spaced, so an unordered list seems the best way to display.
Secondly, this should remain incredibly easy to edit by the site admin (no uploading and hovering over things to get ID's and definitely no code manipulation when images change over time).
So how can I grab a set of logos, where there may be 4-7 depending on how many the site admin wants to add, and place them in an unordered list?
If possible, I would like to lock in text for the first and last li with text.
I've searched images and categories, but unless I'm missing something, images to not have category attributes OOB.
You can use visual composer or wp bakery page builder. You can set group image gallery and also single image. you can build your customize page.

Populating a WordPress Page with posts from a Category or Tag

I have a WordPress for my science journalism blog and I would like to add a page that contains a subset of the blog posts. For example, having a page populated by a certain category (i.e. review articles) or tags (i.e. physics).
There seems to be a way to do this by making a new php page, but I am not sure how to get to a blank template to add the code base.
Alternatively, I would prefer having a way to do this without having to mess with the code at all. Any help would be much appreciated. Thanks!
This happens automatically with WordPress; read the docs:
When a viewer clicks on a link to one of the Categories on your site,
he or she is taken to a page listing the Posts in that particular
Category in chronological order, from newest Posts at the top to
oldest at the bottom.
Read https://codex.wordpress.org/Category_Templates
You don't have to make a category or tag template page, but you can if you want to. This is theme-dependent; your theme may already have different archive page templates.
The URL for a category or tag archive page will be:
example.net/category_base/category_name
example.net/tag_base/tag_name
Read https://codex.wordpress.org/Using_Permalinks#Category_base_and_Tag_base
Go to Appearance>Settings>Reading to set number of posts per page and either excerpt or full post.
I think you should be able to get at a category by going to http://example.com/category/mycategory
And to tags by visiting http://example.com/tag/mytag
You should be able to add categories to the main menu, and add tag pages via a custom link OR use a tag cloud?
Hope this helps.

wordpress posts loop by category name

I am kinda unlucky to find a proper solution in order to display posts by their category. I made a page template that should be supposted to be used in order to display posts by category.
Lets say there is a page "Cats" and page "Dogs" and the same named categories for posts are created and assigned depending on either it is cats or dogs.
How to loop through that?
It should follow dynamics to loop posts of category that is named the same as page title(all those pages using same page template). This should solve the case when you need new page for new category and you don't want to dig into the code and so on.
I would really appreciate the help. Thanks in forward!
If you follow the WordPress template hierarchy, you simply need to name a template file with the category name.
http://codex.wordpress.org/Category_Templates

Wordpress Link Items to Display in Parent Sidebar

I have created a menu like so... http://tinyurl.com/p5xr852
You can see I have added links under "What's Happening?" which I want to use as page anchors from a sidebar.
What I need to do is have these items list in a sidebar when on the parent page.
I have done a heap of research and found that wp_get_links is now deprecated (see here http://codex.wordpress.org/Function_Reference/get_links)
Apparently this has now been replaced with wp_list_bookmarks()
Is there any way what so ever to do this? I don't want to go down the route of creating a heap of multiple menu's as I will be adding these links under post pages to act as page anchors.
I hope I understood correctly. You want that list of links displaying on the sidebar, when the user is in "What's Happening" -page OR any of it's child-pages?
If I didin't understand then just skip this but.
Create a new text widget that has your pages as a list like this:
<ul>
<li>Overview</li>
<li>Schedule</li>
<li>etc</li>
<li>etc</li>
<li>etc</li>
<li>etc</li>
</ul>
Then get the Widget Logic plugin: http://wordpress.org/plugins/widget-logic/
This plugin allows you to choose where widgets appear, for example in certain pages, in archives, in certain languages, in child-pages etc.
Check out: http://wordpress.org/plugins/widget-logic/other_notes/ on how to make this link-list-navigation-widget to appear on the pages you want it to.
It's something like
global $post; return (is_page('15') || ($post->post_parent=="15"));
You put the ID of the page on which you want the widget to appear on. And its child-pages with the latter.

How to colour wordpress menu lis based on category assigned to each page?

I would like to create a nav menu that displays all the pages of a wordpress site, its layout similar to what you would see in a footer sitemap layout, approx 5 columns with all the pages shown. Each page will be a project. I want to use wordpress category checkboxes (like you have for posts) to allow selection of one relevant category for each project page. Each page will then show a category caption below the project's description text, this I will style with CSS so each category has a different background colour.
Because Wordpress doesn't provide categories for pages, I have found a plugin to add this category feature to pages called ninja-page-categories-and-tags: http://wordpress.org/extend/plugins/ninja-page-categories-and-tags/
It's possible to edit the plugin php code under basic-functions.php to return a 'class' for the category displayed using get_slug and then applying css for each.
My problem is that on the menu, which will be a secondary menu in Thirty Ten displaying the pages, I want to be able to colour the background of each link to match the category that has previously been assigned to each page using the ninja plugin. Because the menu works with pages and the categories are not directly linked to the menu items (firebug will not show category details in the html of each link to reference with the css) I am wondering how I can colour each link based on category? Any ideas?
Ultimately what I would like to achieve is a grid of page links that are all coloured based on their category, a colour coded menu.
The plugin uses the standard wordpress category functionality but I just can't think how to connect these category details to the menu items to allow me to style them with css, any help would be really appreciated, even if just a point in the right direction.
Thanks
It's difficult to understand exactly what you're after, but essentially if you want to add extra classes to menu items (which will allow styling), you need to create a custom walker function.
Have a look at a tutorial like this: http://wp.tutsplus.com/tutorials/creative-coding/understanding-the-walker-class/

Categories