Want to include css file which is applicable to only homepage from xml file.
Tried this :
<cms_index_index>
<action add css>
.
.
</action>
</cms_index_index>
using this in local.xml adds that particular css in every cms page.
Any Idea ?
Thanks in Advance.
In the cms home page there is Design(Layout Update XML)
use the following code in that
<reference name="head">
<action method="addItem"><type>skin_js</type><name>js/myjavascript.js</name></action>
</reference>
this solution work for me
<cms_index_index translate="label">
<label>CMS Home Page</label>
<reference name="head">
<action method="addCss">
<stylesheet>
css/custom.css /*This is ur css path*/
</stylesheet>
</action>
</reference>
</cms_index_index>
Try this
<cms_index_index>
<reference name="your cms identifier for home page">
<action method="addCss"><stylesheet>your path/your css file name</stylesheet></action>
</reference>
</cms_index_index>
Please use this code in local.xml or page.xml
Am not 100% sure about the code work or not
In combination with #Leo's answer as well as another blog post I found recently, here's a code snippet to add custom css to just a single page only.
<reference name="head">
<action method="addCss">
<stylesheet>css/custom.css</stylesheet>
</action>
</reference>
Same instructions as #Leo mentioned.
The above suggestions didn't work for me in Magento 1.7, blank theme. What worked was this:
<reference name="head">
<action method="addCSS">
<type>css/master.css</type>
<stylesheet>media="all"</stylesheet>
</action>
</reference>
This produced the following code
<head><link rel="stylesheet" type="text/css" href="http://myshop.com/shop/skin/frontend/mytheme/blank/css/master.css" media="all"></head>
I placed this code into the local.xml of my theme.
Related
I want to redirect my old url https://mysite1.com/#!/page1
to new url https://mysite2.com/page1,
other answers did not help, tried.
<rule name="Red1" stopProcessing="true">
<match url="^([0-9]+)/page1" />
<action type="Redirect" url="https://mysite2.com" />
</rule>
Assuming you meant #! per your example URL, not !# as in your title, add this JS to all your pages' <head>s:
(function(l,p){l.pathname==='/'&&(p=l.hash.match(/^#!(\/.*)/))&&l.replace(l.protocol+'//'+l.host+p[1])})(location);
This basically just removes the first /#!. You may have to alter it if your URLs contain a query part before the fragment.
Followed these instruction to display a 3 column layout for page/post:
fishpig layout XML.
Used the local.xml of the theme in app/design/frontend/my_theme/default/layout/local.xml
but view is still default 2 column layout.
I have looked into this and tested a few things on your site (you provided access details via email) and found that the code at this link does in fact work. The extension uses the layout handle 'wordpress_{{post_type}}_view' for each different post type. Therefore, for posts, you can change the root template with the following XML:
<wordpress_post_view>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
</reference>
</wordpress_post_view>
I have tested this on your site, added it to your theme's local.xml file and refreshed the layout cache. This has correctly changed the root template of your blog posts to the 3 column layout.
For pages, I used the following XML code:
<wordpress_page_view>
<reference name="root">
<action method="setTemplate"><template>page/3columns.phtml</template></action>
</reference>
</wordpress_page_view>
Again, I added this to your local.xml file, refreshed the cache and then your Pages had a 3 column page layout.
I have 2 column left sidebar theme in magento. I have 3 static block already created. Now i want to display these blocks after all product listing and before footer. How can i do ?
I already tried out but these blocks are mixed up with new product.
how familiar you are creating a extension and ad your custom code?. if I understand correctly you want to display 3 different static blocks before footer but after the product list right? in the main column.
Here is what I doing if I need to add something static only for the product list.
You need to create a local.xml file under your package/theme in layout using in your site.
<!-- Catalog Category (Anchor) -->
<catalog_category_layered>
<reference name="content">
<block type="cms/block" name="cms_footer_links" after="category.products">
<action method="setBlockId"><block_id>static_block_1_identifier</block_id></action>
</block>
<!-- Add the same for the rest of the other static blocks 2 and 3 -->
</reference>
</catalog_category_layered>
Add the same code to the N-Anchor Display mode
<!-- Catalog Category (Non-Anchor) -->
<catalog_category_default>
<reference name="content">
<block type="cms/block" name="cms_footer_links" after="category.products">
<!-- The content of this block is taken from the database by its block_id. You can manage it in admin CMS -> Static Blocks -->
<action method="setBlockId"><block_id>static_block_1_identifier</block_id></action>
<!-- Add the same for the rest of the other static blocks 2 and 3 -->
</block>
</reference>
</catalog_category_default>
I did without testing the code but I think should be work, let me know if you have any problem with the code and we can review.
I want to load css file only for products in specific category. For that I'm adding
<reference name="head">
<action method="addCss"><link>custom.css</link></action>
</reference>
on the custom design tab on specific category in admin panel. That gives me
<link rel="stylesheet" type="text/css" href="http://domain.com/skin/frontend/base/default/custom.css" media="all" />
in the page source code.
The problem is, that this provide link from "base" skin, and I need to add it from "myCustom" skin.
<link rel="stylesheet" type="text/css" href="http://domain.com/skin/frontend/myCustom/default/custom.css" media="all" />
Any ideas how to do this using addCss or any other action that I can provide in admin panel/config file?
I think you have not set the value of "Skin (Images / CSS)" from admin. go to System->Configuration->GENERAL/Design->Themes->Skin (Images / CSS) and add your custom theme name.
Hope will help!
Your xml code is OK.
File must exists in /skin/yourpackage/yourtheme/ to be loaded (Not in /skin/yourpackage/yourtheme/css/ )
I notice that if I make a page and add and upload an image to include in it, by default it is included in the site navigation. How can I stop this from happening automatically?
Option 1
There is a Plone setting which tells which types are included in the navigation. Go to ZMI > portal_propeties > navtree_properties > metaTypesNotToList and add Image there.
Option 2
For each image, toggle checkbox "Exclude in navigation" on Image's Settings tab.
if you need to do so on a container basis, you could use the content rule included in sc.contentrules.metadata.
just add it to your buidout and configure it manually to set the ExcludeFromNav field to True.
an alternate way to do so is to include a contentrules.xml in your project profile with something like this:
<?xml version="1.0"?>
<contentrules purge="True">
<rule name="exclude-on-add" title="Images are excluded from navigation when added"
description="" enabled="True"
event="zope.lifecycleevent.interfaces.IObjectAddedEvent"
stop-after="False">
<conditions>
<condition type="plone.conditions.PortalType">
<property name="check_types">
<element>Image</element>
</property>
</condition>
</conditions>
<actions>
<action type="sc.contentrules.actions.ExcludeFromNav">
<property name="exclude">True</property>
</action>
</actions>
</rule>
<assignment name="exclude-on-add" bubbles="True" enabled="True" location="/your-container"/>
</contentrules>
You have the options for Navigationin the Site Setup menu.
Remove the tick on image for displayed content types and images are not longer shown on site navigation and site maps.