How to display blog post in wordpress? - html

I have a wordpress theme "Hatch", and I'm doing it for my photography. I usually do websites with HTML/CSS (in Dreamweaver), and this is the first time doing Wordpress.
In My homepage, you can see the recent posts as thumbnails. I'm thinking of creating a new menu, called 'Blog', basically just like what normal themes do, displaying blog posts. It might be something simple, but i just can't find what to code to make the posts display as normal display .
the website is lizettephotography.com
thanks heaps!
Liz

No need to code.
Create new category "Blog". Add that category to your main menu.
After that add new post to Blog category. on click blog menu link will show all post having blog category.
You need to format post design as you want.
EDIT :
In order to activate “post formats” in WordPress 3.1+, you will need to open your theme’s functions.php file and paste the following code:
add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
Note: aside, and gallery are not the only available post formats. The available list of post formats are:
aside – Typically styled blog format.
chat – A chat transcript.
gallery – A gallery of images.
link – A link to another site.
image – A single image.
quote – A quotation.
status – A short status update, usually limited to 140 characters. Similar to a Twitter status update.
video – A single video.
For the full list of post formats, refer to WordPress Codex.
Once you have added this code, you will see a new field in your post write panel in the right hand column where you see publish.
Upon writing the post, you can change the format and hit publish. This will allow you to display your post in a pre-styled format.
Edit your post loop.
Suppose in your case blog category post format is asid
We are going to be utilizing the conditional tag: has_post_format()
if ( has_post_format( 'aside' ) {
// Blog Category format
}
else
{
// Normal Formate
}
I hope this will help you. More Info...

Related

How to make a custom Archive page with Wordpress using custom post types and acf fields

I am building a child theme on GeneratePress to create a custom site for a client and am stuck on customizing the Archive pages. I've determined that it will be best to ignore the theme functionality and build the page loops from scratch. The custom archive should take the place of wp/generatepress' standard archive page and function in the same way by showing relevant posts when a taxonomy term is clicked. I need to be able to choose which html tags are used and style them with css. My issue is that I don't understand wordpress dev enough to figure out how to do this.
I have two custom post types, Research and Resources, as well as a bunch of different custom taxonomies that are applied to both or each post type. I'd like to customize the archive page (with archive templates if necessary) so it displays the appropriate Research and/or Resource files when visited.
I understand that I need to loop through all the posts, but I do not know how to grab only the relevant ones per the given archive page.
Examples of loops with example content will be the most helpful. Thank you!!
I chatted with someone on Reddit who kindly answered this question for me here.
They said:
So I wouldn't do it as a template personally (you could), I would do it through having two new files a archive-research.php & archive-resources.php.
Then if the loop is going to be the same on both pages, which I think you said it is going to be (you just want to display the posts from each custom post type), I would use a template part.
So create a new folder in your theme folder called inc or includes and name the file custom_post_loop.php (name can be anything).
Then in your archive page, call...
<?php get_template_part('inc/custom_post_loop');?>
In that file you are just wanting to write a simple post loop in there.
while ( have_posts() ) : the_post();
// Your loop code
// just so you can see this work I have called the title
the_title();
endwhile;
else : _e( 'Sorry, no posts were found.', 'textdomain' ); endif; ?>
https://developer.wordpress.org/reference/functions/have_posts/
Have a look at that link to find out more. But thats the direction to go...
If you really wanted to got the direction you have with the template, you would have to add arguments to your posts loop.
it works the same way but instead of archive.php its taxonomy.php...
However, you don't want a taxonomy-{taxonomy name}.php file for each taxonomy as that would be ridiculous unless you knew all the taxonomies haha and had really specific user cases for them...
so just create a taxonomy.php in your theme files and to make sure its working just add this code to it...
<?php get_header();>
<h1><?php the_archive_title();?></h1>
//then put your loop in from earlier...
<?php get_template_part('inc/custom_post_loop');?>
<?php get_footer();?>

2SXC Blog App - Post Detail Page - No demo item exists for the selected template

When clicking a blog post to bring up the post's details page, the detail does not load. Instead there is an error that reads "No demo item exists for the selected template."
Not sure what I'm missing.
Platform:
DNN v9.2.2,
2sxc App v9.32.1,
2sxc App Blog v03.00.02
This is my first install of 2sxc, love it thus far, thanks!
I added the blog app. The 3 (or four) example blog posts were there and things seemed to be working correctly. I edited the author to be one of our authors. I deleted all the blog posts except the latest one. The latest one I edited to a new actual post for the site.
When I click on the blog post to bring up it's full details, I get the "No demo item exists for the selected template." error message. I also tried a new blog post, and the new post suffers from the same issue.
I'm not sure what I'm missing. Any help you can provide would be greatly appreciated!
Since you "cleaned up" a bit, my guess is you probably deleted the demo-entry which is configured as a default for a view. This isn't a necessary entry, but usually helpful during development.
I suggest you go to app-administration (ellipsis button till you see a 1-gear-icon, click on that gear). Then go to views. Edit the view "Post Details" and either set the Content-Demo-Item to the one you still have, and you should be good to go :)

PdfBook Extension - MediaWiki - Fullurl parser function link automatically to every category page

I am able to display a download link in category to download all the pages of that category.
In the below link, it is written as
In order to include this parser function link automatically to every category page, add it to the Mediawiki:Categoryarticlecount page.
Rather than adding the download link manually to all categories, i tried the above. That is, added the download link in Mediawiki:Categoryarticlecount page to automatically include the fullurl parser function link to every category page. But it didnt work.
Parser function link : [{{fullurl:{{FULLPAGENAME}}|action=pdfbook}} | Download]
How to achieve this?
Any help is appreciated.
You have two typos in there:
The system message is at MediaWiki:Category-article-count (note the camel-case in MediaWiki)
The external link syntax is [url text], not [url | text], so it should be [{{fullurl:{{FULLPAGENAME}}|action=pdfbook}} Download]
Other than that, your code looks fine.

Understanding wordpress the_content

I have been asked to tweak a friend's website. The website was built for them using Wordpress by an agency they no longer work with. Problem is, I don't know very much about Wordpress, so I have some basic questions…
I can see (by comparing the source as viewed in my browser to the php templates that I can edit through the Wordpress interface) that the elements I need to modify are generated by the page's call to "the_content()". I don't really understand what this function does, but I think it pulls content for a given page from the MySQL database. Is that right?
I suspect that the Wordpress interface alone won't be enough to let me modify elements that come out of that database. Is that correct? How does anyone change, for example, the specific arrangement of text and images on a page if the relevant markup is fetched by "get_content()"?
When developing for WordPress or even just tweaking, it's really important to get at least a general understanding of the "loop" and how we use it for output. In order to output the content you need to call the method within the loop. If it's not within the loop it won't get inserted into your page.
(It works this way with all of your pages... index.php, page.php, single.php, post.php, etc... Your methods need to be placed within the loop in order for them to display within that page.)
Here's a simple example of the way the loop is used to output the title and content of posts:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> // loop start
<h1><?php the_title() ;?></h1>
<?php the_content(); ?>
<?php endwhile; else: ?> // loop end
<p>Sorry, this page does not exist</p>
<?php endif; ?>
If you take a look at any standard WordPress theme (take Twenty Fourteen, for example), you'll find that the_content() is output together with calls to other elements (in this case - the_title()). If you want to want to change the arrangement of the specific elements within your page, just modify the order as they are within your loop, or check the WordPress Codex for additional options/methods.
Here's a short list of some other things you can display:
next_post_link – Displays a link to the post published chronologically after the current post.
previous_post_link – Displays a link to the post published chronologically before the
current post.
the_category – Displays the category or categories associated to the post or page being viewed.
the_author – Displays the author of the post or page.
the_content – Displays the main content for a post or page.
the_excerpt – Displays the first 55 words of a post’s main content then with a [...] or read more link that goes to the full post. The length of excerpts can be controlled by using this slightly advanced method or by using the Excerpt field on the post edit page.
the_ID – Displays the ID for the post or page.
the_meta – Used to display custom fields.
the_shortlink – Displays a link to the page or post using the url of the site using
the ID of the post or page.
the_tags – Displays the tag or tags associated with the post.
the_title – Displays the title of the post or page.
the_time – Displays the time or date for the post or page. This can be customized using the standard php date function formatting.
If you want to further customize some of these methods, you can do that within functions.php. Otherwise, all styling is done within your styles.css.
Probably your content is being generated by a shortcode.
You can modify the content that wordpress fetches from the database with the_content filter:
// returns the content of $GLOBALS['post']
// if the page is called 'debug'
function my_the_content_filter($content) {
// assuming you have created a page/post entitled 'debug'
if ($GLOBALS['post']->post_name == 'debug') {
return var_export($GLOBALS['post'], TRUE );
}
// otherwise returns the database content
return $content;
}
add_filter( 'the_content', 'my_the_content_filter' );
maybe its not the best solution but you can modify the content before it gets output.
source

WordPress Paradox - Normal posts not being queried

I am in a situation that i can't figure out. I am running a WP 3.4.2 on a site with multiple custom post types. The normal posts are displayed in the blog section and are in a category called blog with different subcategories.
Blog posts and another post type called 'events' display tags in single view. The tags display fine but when you click on a blog post tag no posts are found. Tags related to events work as expected.
The really weird thing is in admin. when I search a tag that is related to a normal post, it finds it and counts how many posts it has, but when clicking on the number of posts is says "No posts found.". With the tags related to events this never happens.
Also, categories have the same problem.. display just posts from events..
Also I tried to make another post type called "blogposts" to display on the blog page instead of normal posts but same sad story.
As far as I see in the code, in archive.php and tag.php, normal posts are not returned from the query, just events get through.
I have this in functions.php
function namespace_add_custom_types( $query ) {
if( is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array('post', 'events', 'blogposts' ));
return $query;
}
}
add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
Any ideas would be really welcomed.
Thanks!
This is a weird problem. Most likely caused by a combination of plugin(s) and/or theme.
So first we need to figure out where the problem comes from. So:
turn off all plugins to see if it changes.
Or do it one by one
turn off parts in functions.php in your theme.
turn as many off as possible and see if things change
To find this problem we need more specific information.
Is it your won theme or someone else's?
What plugins are active?
Is this problem new, or did it just 'popup'?
good luck and let me know what you find ;)