Need Help for my Custom Page Template - wordpress

I'm very new to this PHP coding.. actually I'm not a programmer, but I need this help from anyone here...
Anyway, what I need help from you:
I have written a small snippet of Custom Page template, here it is:
------------------------------
<?php
/*
Template Name: MyCustomTemplate
*/
?>
<?php get_header(); ?>
<?php get_footer(); ?>
------------------------------
Now I have installed a wordpress slider plugin "Nivo Slider"..
Now I'm not understanding how do I call this plugin into my custom template...
Iam trying to achive home page with a Slider and some ads in it.. eg: I need my home page like this: www.papayaclothing.com/shop/
So, could anyone please provide me a code to work that?

Please try following code, make sure that slider you are trying to call is published:
<?php
//valid for Nivo Slider version < 1.8
echo do_shortcode('[nivoslider slug="my-slider"]');
?>
Let me know if my answer was helpful.

Related

Wordpress page content variable

I am new to wordpress coding but familiar with standard HTML/CSS. With the help of various online tutorials I've finally gotten a good chunk of a simple HTML/CSS website converted to wordpress but Im missing out on some of the basics.
In this case, I am just trying to setup my template to work with the page.php file so that I can create pages through the wordpress admin console. I've figured out how to get the head.php, footer.php, and functions.php working for styles and js files but now I am struggling with what variable I need to place so that the title and content I enter into the page via the wordpress admin appears.
I've tried
1) using a div id=content to my page.php file --that didnt work
2) I've tried adding to my page.php file -- that didnt work
I cant seem to figure it out. Any help would be greatly appreciated. I am a definitley a beginner here so any help is greatly appreciated. Thanks!
This is a very basic template of a page.php in Wordpress.
<?php get_header(); ?>
<div>
<?php
if( have_posts() ) :
while ( have_posts() ) : the_post();
the_title(); // Outputs the title of the page
the_content(); // Outputs the content of the page
endwhile; // End of the loop.
endif;
?>
</div>
<?php get_footer(); ?>
Also, if you would like to store the title and content in php variables first, you can just call get_the_title() and get_the_content()
Please let me know if you are stuck.

Wordpress - theme doesn't show newest posts

I have a website with Wordpress and free template Creative on this link: http://kristinauhrinova.com.cluster3s23.dnsserver.eu/
I don't know why, but on bottom of the home page it doesn't show previews of newest added posts like in template demo http://dessign.net/unittheme/
Can you help?
Thanks, Filip.
Looks like there is no loop in the index.php. You may have to write one yourself. To pull the previews if one doesn't already exist. Here's the WP Codex page about The Loop. Hope this helps.
try to add this code on the home page,
<?php the_title(); ?><br />
<?php the_content(); ?>

Basic Fishpig Wordpress Integration - Display Custom Post on Homepage

I'm trying to create a slider on the homepage of my Magento site. I am totally new to Magento and have someone else on our team coding most of that stuff after realizing how far into the deep end I jumped.
My issue: I'm trying to pull custom posts from WP (with the paid advanced custom fields extension) to display an image that will go into a slider.
I'm stuck at the most basic part - pulling in a list of Wordpress posts.
I created a new file: mytemplatedirectory/default/template/home/slider.phtml with
<?php $posts = $this->getPosts() ?>
<?php foreach ($posts as $_post) : ?>
<?php echo $post->getPostContent() ?>
<?php endforeach ?>
and I put this into the CMS page in the Magento admin:
{{block type="core/template" template="home/slider.phtml"}}
But not even the default post is showing up.
If anyone has any guidance that would be extremely helpful. The beginning steps are what are throwing me off but it would also be nice to have help pulling the custom post and the advanced custom field (although it seems that Fishpig's documentation makes this pretty simple).
Thanks in advance! Sorry for such an amateur question.
The block type you're using does not include the getPosts() method, which is the reason your call to this returns nothing. If you change the block type to 'wordpress/sidebar_widget_posts' then the call to getPosts will return a post collection object.
The following link explains a little bit more about how to include this block and what you can do with it:
Display WordPress Blog Posts on the Magento homepage
Figured this out with Ben's help (who I believe is the creator of the excellent Fishpig extension).
I created a custom post (with the Custom Post Type UI plugin for WP) and a custom field (with the Advanced Custom Fields plugin for WP).
On my Homepage in the CMS I added in the content area
{{block type="wordpress/sidebar_widget_posts" name="wordpress.widget.recent_posts" post_count="5" post_type="slider_home" template="wordpress/sidebar/widget/slider_home.phtml"}}
In that block, slider_home is my post type and slider_home.phtml is a new file I created that pulls the code from wordpress/sidebar/widget/posts.phtml but customizes it to my need.
Within the loop in slider_home.phtml I took out what was currently there and added:
<?php $image = $post->getMetaValue('image'); ?>
<?php $url = $post->getMetaValue('url'); ?>
<a href="<?php echo $url; ?>" target="_blank">
<img src="<?php echo $image; ?>" />
</a>
which is pulling in the custom fields I made in Wordpress. works perfectly and now my client will be able to update their Magento site through the Wordpress CMS.

Disqus comment form not displayed on self hosted Wordpress site

I have followed all instructions on installing Disqus commenting system on my website but the old comment form is still visible.
My question is: is <?php comment_form(); ?> enough to display the comments or there needs to be something else on the single.php page.
What else should I be taking care?
I don't have any other commenting engine installed.
Thank you
OK I found it.
Instead of using the <?php comment_form(); ?> I had to use <?php comments_template(); ?>.
That did the trick
install woody snippets on your site
insert a new php snippet:
comments_template(); ?>
go in widget select custom html and place the code:
<div id="disqus_thread">
[wbcr_php_snippet id="THE ID WHAT WOODY GAVE YOU"]
</div>
and place the widget where you want
obviously don't forget to enable comments site-wide

Unable to add a new region to sub theme

So I have a Bartik sub-theme that I am using for my website. Now the idea is to add a custom region to this theme. I am following the process described below:
Add custom region to subtheme.info file like : region['custom_region'] = Custom Region
Add to subtheme's page.tpl.php page:
This does not work and the custom region does not appear when I check for it.
I did the same for the Bartik theme (that is the default provided theme) and it works fine, meaning the custom region appears where it ought to be.
So what's fishy here? : p
Thanks guys!
You shouldn't need the apostrophes. Also, you should define the region as "regions" - so try this in your .info file:
regions[custom_region] = Custom Region
Good luck! :-)
In page.tpl.php page insert:
<?php if ($page['custom_region']): ?>
<div id="custom_region">
<?php print render($page['custom_region']); ?>
</div>
<?php endif; ?>
And Flush all caches

Resources