Silverstripe get site attributes from SiteTree - php

in my site I have the pages "Product" and "Reference".
I'm trying to link the references to their product and display the product icon on the reference page.
I'm using SiteTree with a TreeDropdownField to select the page in the admin backend
On the Frontend I'm trying to use $ProductLink.ProductLogo.URL but that does not return anything.
$ProductLink.Title and $ProductLink.AbsoluteLink work. It seems like accessing native page attributes works but attributes from my ProductPage do not work

Related

Woocommerce: Product category page using the wrong template

I have a WooCommerce store set up and I need to have it so that the store front shows the categories and then clicking through lists the products in that category. I have changed the store url to /soft-sell (it's a brand thing) and got it looping through the categories. The url for the click through page is /soft-sell/joe-b (for example), but the click through page is using the 'page-home.php' template and I can't find anything about why this is happening or how to change it. All I'm seeing on the category page is the home page. Anyone have any ideas?
Further info: I have declared woocommerce support in my functions
In case anyone finds this in the future, the solution is posted here
It's to do with the permalinks page having the incorrect custom structure, it needs to be /%product-category%/ not /%product_cat%/

Custom Post index page displaying all Custom Post's - without slug conflict

I usually code in Ruby on Rails where each model has "Show" pages and "Index" pages. I am now re-creating a website in Wordpress (based on an old RoR-site) using Custom Post for each model.
I have, for example, a model named Review. In Rails if Reviews have the slug /reviews then each Review will have a url like /reviews/this-review and at the url /reviews all the Reviews can/will be listed. 
It seems like in Wordpress with Custom Posts I choose a similar slug /reviews for a Custom Post which creates each review as /reviews/this-review or /reviews/123 (which is fine) but there is no index page created where I can display all reviews on /reviews. 
I have solved this by creating a Page called Reviews with that slug (/reviews). There is no conflict when I add the Page but if I update the Custom Post it complains about the slug already being used. 
What is the typical way of solving this in Wordpress so that I can show all Reviews (Custom Posts) on one page without slug conflicts?

How to get seo friendly article url in joomla without assiging it to any menu

I am a wordpress developer and new for Joomla cms. Currently i am working on a Joomla project.
I have created articles from admin section and i want to call those articles in my front end with seo friendly url(http://www.example.com/article-alias) without assigning it any menu.
I am already using url like this /index.php?option=com_content&view=article&id=article_id to get article in front end.
Thanks in advance for any suggestion or solution.
In my Joomla instance I created a new menu called "blank" to put any articles I wanted to link to directly instead of adding them to the navigation on the site. I assigned my articles to that menu, and there is a field called "alias", manually type in the name you want to appear in your URL (like article-alias). Then you can link directly to that page with example.com/article-alias. This will also allow you to add modules to the page from the module manager and selecting your articles from the "blank" menu.

How to create single-custom.php for different repeater fields (using Advanced Custom Fields) in Wordpress

I'm using Advanced Custom Fields Pro with Wordpress 4.1.1
I feel like this should be pretty easy but I've been struggling with it.
The example I'll start with is I have a "Team" page that has a repeater with:
Profile Image
Name
Job title
Short biography
Email/social link
All as sub_field
I have everything working nicely in the page where all posts are display (the actual Team landing page) but I can't figure out how to get content for each employee to live in a single-custom_template.php with a permalink.
tl;dr I want my repeater content to be able to navigate to a single post/page with it's own custom template. Click on "Dave" in the whole team page have it navigate to his bio page.
I think you would benefit in building a custom post type for "Teams" so you're not selecting a new custom template (single-custome_"".php) each time you post another team member profile. This way also allows you to have all your custom meta fields organized under a single custom post-type. However, if you don't want to go through all the trouble in creating a custom post-type, you can post each single team member page as a child page to your parent "Team" page, so that the url would look something like, "yourdomain.com/team/team-name, and then have all your custom meta fields auto populate when you select the single-custom_template.php in the "template" dropdown field.

Adding 'active' class to wp_nav_menu when viewing post

I have a Wordpress site comprised mostly of pages, but there is one page (news section) that contains posts and categories like a blog would. I'm generating my nav using wp_nav_menu() with only the top-level pages displayed. I have styles set for the current link and the current link's parent that use the .current-menu-item and .current-page-ancestor classes that wp_nav_menu() automatically adds.
However, when you're viewing a post within the news section, no classes are added to the nav to indicate that you're in that section, and there's no way to style the "news" link to show that it's the section of the site the user is in.
Is there a way for WP to "know" that posts belong to that page? It's not a category because since no other sections of the site contain posts, the categories field is open and the editors can add whatever categories they want.
Do you have your "News" page set as your blog page, in the "Reading" settings? If so, it should add the class "current-menu-parent" and "current-post-parent" to the "News" <li> when you are viewing a post.
According to Wordpress template hierarchy (and specifically this diagram) a single post is being displayed by a file called single.php (or single-<post_type>.php. A set of posts from a category will be displayed by category-<post_type>.php template file.
Now, if you abide to this hierarchy, you'll have two more templates - news list and news detail page. Having two pages with these templates will make them automatically listed by Wordpress menu-generating function.
If that's not enough for you, you should use WP_Query to manually list your pages. If you decide to do it this way, one or two if statements should do the job.

Categories