I am running into a problem when coding a theme.
My wordpress folder lives in public_html/
The permaline setting is set to "Post name", so it is something like http://websiteurl.com/post-name/
In my theme, I want to load an image that lives in public_html/media/, but when I use
<img src="media/img.jpg">
the browser tries to find the image in the folder public_html/post-name/media/img.jpg. How should I code my theme so this does not happen? I don't want to change my permalink option to ?page=ID.
Thank you!
It will better to use full absolute path like
<img src="http://websiteurl.com/media/img.jpg">
. So it will not create issue when your path will
http://websiteurl.com/category/post-name/
Try
<img src="/media/img.jpg">
instead. The first / will make the browser start looking under public_html instead of under post-name.
Related
i've created a php file in my theme folder named page-test.
When i try to bind this template to any page, i can't see it
Impossible to guess what is the problem. Someone could help me ?
Thx
Can you make sure your child theme is activated, i mean where you put your file, also can you change file name to page_test.php
Let me know if problem fixed.
Ok i got it.
It's not in "page attribute" anymore but in the "modele (in french)" part.
I am having great difficulties getting an image resized using Twig/Timber in Wordpress, here is my code - is there something I am missing?
<img src="{{ theme.path ~ '/images/dog.jpg' | resize(250) }}"> it just outputs wordpress.local/wp-content/themes/custom-theme/images/dog.jpg instead of wordpress.local/wp-content/themes/custom-theme/images/dog-250x0.jpg
Any suggestions appreciated!
Your image doesn't part of WordPress theme, I mean, it is but it's not been handled by WordPress Media Library using wp_handle_upload or similar approach.
Timber documentation says
All of these filters [* - resize, letterbox] are written specifically to interact with WordPress’s image API. So don’t worry, no weird TimThumb stuff going on—this is all using WordPress’s internal image sizing stuff.
That mean your images need to be uploaded by WordPress itself with all picture metadata - not just present inside your theme or even uploads directory.
I'm new to WordPress. I read that, in order to use a new theme, I need to download it and save it in wp-content/themes. I did that, and I see the new theme on
http://localhost/wordpress/wp-admin/themes.php
but when I preview it, there is nothing.
What should I do?
First, your theme directory should be like this: wp_root/wp-content/themes/your-theme . And all themes have index.php and style.css
It might be problem in theme code. you may contact theme provider.
I would like to change the link in the Plone logo viewlet. By default it points to the Plone site root, I want to point it to a location that is not within the Plone site.
I tried writing a custom logo viewlet, but this seems very complex for such a small change. What is the best way to do this?
The easiest way to change the Logo link is to override the logo viewlet template. This is best done with z3c.jbot.
You need to add z3c.jbot to your projects custom product, by adding it as a dependency in setup.py, and also set up the configure.zcml correctly:
<include package="z3c.jbot" file="meta.zcml" />
<browser:jbot
directory="templates" />
Don't forget to make sure you have the browser prefix added in the <zcml> tag.
You can now copy the logo.pt file from plone.app.layout to the templates directory in your custom product. Rename the file to plone.app.layout.viewlets.logo.pt and change:
tal:attributes="href view/navigation_root_url;
title view/navigation_root_title"
To:
href="http://stackoverflow.com"
Restart the server, and the logo link has now changed.
Alternatively you can edit it via ZMI (/manage) in portal_view_customizations. And search for the "plone.logo" view.
It should open this url in the frame:
/portal_view_customizations/zope.interface.interface-plone.logo/pt_editForm
Hi
Anyway to stop people browsing the Drupal home page and redirect to my specific html page?
Thanks you
For Drupal 7 you need to use page--front.tpl.php
If your theme doesn't have a page.tpl.php that you can copy, then copy it from your base theme if you are using one or:
modules/system/page.tpl.php
This should be placed in your custom theme folder in (assuming this is not a multisite):
sites/all/themes/my_theme
I tend to structure my themes as follows:
my_theme.info
templates/html.tpl.php
templates/page/page--front.tpl.php
templates/node/node.tpl.php
templates/block/block.tpl.php
css/style.css
But it doesn't really matter where it is, it will be picked up after a cache clear.
If you have specific HTML page that it is on the server and doesn't generated from Drupal, the most easy way is to use Drupal goto.
How to do it? open your template.php and search for page_preprocess function it should look like that:
YOURTHEME_preprocess(&$variables, $hook) {
if( drupal_is_front_page()) {
drupal_goto('yoursite.com/yourpage.html')
}
}
change YOURTHEME to your theme name and clear the cache.
The real Question why should you use static HTML file for your homepage? I would create some article or view for homepage and change it as I like with theming... It is much easier than any other alternative.