I want to add a 'featured page' button/widget to a sidebar in Wordpress that will show a thumbnail of the page as well as the page's custom excerpt (I'm using http://wordpress.org/extend/plugins/page-excerpt/).
I got it sort of working using either a custom text widget or http://wordpress.org/extend/plugins/featured-page-widget/ but it doesn't show the excerpt, it just generates one from the page's main content.
Anyone know an easy way to do this? My hope was for non-web designers to be able to update this kind of content.
You can easily achieve this by activating this plugin http://wordpress.org/extend/plugins/php-text-widget/ You can put your php code in the widget. This means you can also put your WP_QUERY, query_posts or get_posts loop in order for you to get the page you want.
Activate the plugin go to your widget page use the text widget and drag it to your widget area and paste this
<?php
$the_query = new WP_Query();
$the_query->query("page_id=$page_id");
if ($the_query->have_posts()) :
while($the_query->have_posts()) : $the_query->the_post();
//show thumbnail
if(has_post_thumbnail()) :
the_post_thumbnail();
endif;
//show excerpt
the_excerpt();
endwhile;
endif;
wp_reset_postdata();
?>
Related
I am using the Hueman wordpress theme in my home. I want to show the featured image on the post but I don't want to that image in a single post.
Can anyone help with this? Here is the link
I think you want to customize single post detail page.
So, go to single.php.
Usally this file is located in your theme path that is as below.
www.domain.com/wp-content/themes/your-theme-name/
Go to above path and open single.php. In that remove below code get_template_part( 'content', get_post_format() ); and replace it with
the_title(); //For Post Title
the_content(); //For Content of the post
If you want to add image use the_post_thumbnail( 'single-post-thumbnail');
I'm designing a website using WordPress. I want to know how to remove the post and comment boxes which is available by default in WordPress...and also I want to know how to add plugin's in that static page
First, create page with name "Home", insert shortcode of plugin or anything you want.
Second, go to Apperance, choose Customize. At Static Front Page, tick A static page radio button, choose "Home" from dropdown list Front page. Save.
In order to remove comments yoy must select the "Screen options" in the post editor (it's an option located at top-right on the screen) and check the Comments checkbox. Then at the editor's bottom you'll find a box with a checkbox to disable comments.
If you're working in Wordpress.com you cannot add plugin's for free. This is for security reasons. You must install Worpress in your own server to do that.
Ok, as per your comments on main question, I understand you want to remove posts and comment box on public facing page, not in WP-Admin panel.
I am giving you an overview of how you can proceed.
If you are using default TwentyThirteen thee then just remove this part from single.php
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php twentythirteen_post_nav(); ?>
<?php comments_template(); ?>
<?php endwhile; ?>
This will remove post and comments template.
However I will recommend you to use custom page templates rather :
http://codex.wordpress.org/Page_Templates
Here you'll find way to add custom page templates. There you can remove posts and comments :-)
I am new to wordpress theme. I have created a wordpress theme by creating index.php and style.css. This theme is actually a blog theme. So, i have designed all the section in index.php and that is my front page and i have write the php code to display the blog post from the wordpress automaticaly. It works fine.
My question is, when i click on the title of the blog post it goes to the next page which indicates mysitenamedomain/post-id and i seems nothing on that page. whether i want to create a single.php page to display the title, content etc on that page?
In single.php you have to use loop
Here is documentation: Codex
Try: (in single.php):
<?php while ( have_posts() ) : the_post(); ?>
<h3><?php the_category(' › '); echo " › "; the_title(); ?></h3>
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
Of course you have to style it.
login admin panel and create a new post here by clicking the "POST" menu of dashboard, put the post title and post content here and then save it . after that check single page on website it will display the title , content etc
I'm simply trying to show the content of posts in category 7 on a template page. I'm using the following on the template page:
<?php
$custom_query = new WP_Query('cat=7');
while($custom_query->have_posts()) : $custom_query->the_post();
echo get_the_title();
endwhile;
wp_reset_postdata();
?>
This code is ONLY returning the title of posts in category 7, and is not outputting the actual post content. I added the get_the_title() line only to see if the query was actually querying the posts. Since it returned the title as expected, I assume it is querying the posts as it should. But why no content?? This is currently a local site so I cannot provide a link. Is anything glaringly missing in the above code?
Surely you need to add the_content(); in the query to make the post content visible?
I basically want a Wordpress "Page" that acts just like the home page and loops through recent posts and displays them. How do I do this?
If you go to Settings->Reading and then for "Front Page Shows" select static page, and then select a page from the dropdown, then edit the source code for this file to include a standard WP loop like -
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<h2><?php the_title() ?><h2>
<?php endwhile; endif; ?>
Use the wordpress loop, but you can control which posts show up in the loop using query_posts()
http://codex.wordpress.org/Template_Tags/query_posts