I am using Meteor Slides plugin for showing header in slideshow.Now what i need is to show this header on only home page and show different header images in different pages. I got a plugin called "WP Display header" for displaying different header images for different pages.But the slideshow header along with two custom headers with same image which i set using WP Display Header plugin. How can solve this problem and show the slideshow on the homepage only and different headers in different pages? Someone please help me.
I have got answer for it. I have changed the code to add meteor slides plugin in functions.php to show the slideshow just in the homepage.
<?php if ( is_front_page() ) {
if ( function_exists( 'meteor_slideshow' ) ) {
meteor_slideshow();
}
} ?>
After that i used a plug called WP display header to set header image for each page
Related
I am new to wordpress and learning Plugin development, I m creating a custom plugin, which display a list of page-title with check-boxes in admin section and on checking the selected pages footer should be remove from that pages, now I m facing issue with how to remove footer section?
I dont want to remove footer on single page, so custom template can not be used
I dont want to remove footer using css(like display none)
Can anybody help?
You can use Wordpress's remove_action to help remove unwanted php calls. More on that found here
Something like this:
function your__conditional_footer() {
if( is_front_page() )
return;
remove_action( 'theme_before_footer', 'theme_footer_widget_areas' );
}
Mind you, the function arguments are theme dependent.
Hope this points close.
How to create two pages with same content?
For example, the first page should be with a header menu and the second page should be without a header menu.
The page of my theme has an options without header
Or I can use two different templates of page, but the content of pages should be the same.
You can read the documentation here.
Create a file, called page-mytemplate.php under your theme directory.
In that file, start with this:
<?php
/*
Template Name: My Custom Page
*/
Create a page, and set the template to My Custom Page.
At here you can do whatever you want.
For the other page, repeat the steps, but just call the other template something different name.
EDIT
When you want to show the same content with different templates, just simple get the content of the page:
$post = get_post($postId);
echo $post->post_title ."<br />";
echo $post->post_content;
You can wrap this with your two template page. See the documentation here
I'm just starting with wordpress. I create blog and right now I have index.php with list of posts. If I add images to posts in admin panel , images have href but they redirect to attachment - not to post. Of course I can use:
has_post_thumbnail()
but this works only if I set it in admin.
My question is : How to create redirect to post as default (not to attachment ) for images added to post.
This is typical of WordPress and is supposed to happen. It is up to the author when inserting media into the page how it is displayed. See the Attachment Settings in the Bottom Right of the Corner. You will want to select None or Custom URL based on your preferences. Yours is currently set to "Media File" Like the screenshot below.
You can add this snippet of code to your themes functions.php file to change the default settings:
function image_overrides() {
update_option('image_default_align', 'center' ); // Changes the alignment
update_option('image_default_link_type', 'none' ); // Changes the Link type
update_option('image_default_size', 'large' ); // Changes the default size
}
add_action('after_setup_theme', 'images_overrides');
I have created a front page (i.e index.php) with my own design. This page will contain
header got from <?php get_header(); ?> [has navigation bar code]
Then some content. Here I'm showing three thumbnails of posts. [has slider, thumbnail posts etc]
And a footer from <?php get_footer(); ?>[has footer links]
The problem is, I see index.php loaded correctly as a front page. But when I navigate to other pages like About or Contact, the respective content from these pages is not showing up. Instead what getting loaded there is, same what Index page has. I don't want slider or thumbnail appearing on these pages.
So how to tell wp that, this is my front page, and this is my About page, don't load a slider and stuff on About page!?
use is_front_page() to determine the home page. like you only want slider on the home page then edit your header.php file that consist the slider part and do something like this
if( is_front_page() ):
// Front Page stuff like slider and
// whatever you want
endif;
Try this ,
if( is_home() || is_front_page() ){
//your home page content
}
else{
//other pages
}
For more here
Hope its works..
Make another template and set this template for your single pages. And then from backhand set it.
I usually create a front-page.php file, Wordpress will use that instead of index.php (which you can use as a generic template from then on).
My site needs to have image based posts, meaning the post is only an image.
Now i tried implementing it with Custom Post Types, but have encoutred problems,
like categories didn't show the right posts, pagination caused problems etc.
Now i thought to myself that i don't need the regular posts and if i could just edit them
to have only the featured image option enabled, life would be much easier.
But i failed to find any information regarding this.
Anyone can help me please?
To add featured image support/option simply add the following code snippet to your functions.php file located inside your theme's root folder
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
}
and to show the featured image inside your template you can do
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail(); // will show the featured image if you have set any for the post
}
Applicable to Wordpress version-2.9 and higher.
When you add new post just find the featured image meta box and set an featured image from there.
You can also setup image sizes (depending on that images will be displayed) at the front end, just take a look at here.