I have created a wordpress.org blog on my website but I do not use the actual blog page to display the blog posts. Initially I tried to style the wordpress blog to match my site, but since wordpress' theme is too constricted I decided to use "the loop" to gather the_author_posts_link, the_title, the_content, etc and display them on my main page. (reference: http://www.corvidworks.com/articles/wordpress-content-on-other-pages). The problem I am running into is the comment section. No matter what, I cannot seem to find a way to add comments to my front page using php. I know I can get my post content to display by calling the_content(), but I cannot seem to find a similar function for comments. I'm open to any solution that will allow my pseudo-blog to display comments under each post.
Thank you!
Should be <?php comments_template(); ?>. Look in your theme files for that template tag. But it working depends on if you've correctly included the blog header on your non-WP pages.
Related
I use Elementor page builder on my WordPress site. There is a problem with it - by default it doesn't allow editing WooCoomerce Shop/Products pages. The solution they say is to add to page templates code. I, being a beginner with no idea of coding, cannot figure out which file to add this code to and where in that file. I have been researching and trying to fix this myself for two weeks now, in vain. Please help me achieve this.
Here's what Elementor say: "Sorry, the content area was not found in your page. You must call the_content function in the current template, in order for Elementor to work on this page."
Go to Elementor setting and then check products in post types
Go to Products, click Edit on the product you want to edit, input something (ie. a full stop-sign '.') in the WP Editor, click Update. (See attached screenshot.)
Screenshot
There seems to be a misconception that Elementor can be used to "edit" any content.
For Elementor to work on a "Page" i.e. the post type that uses either the page.php or any theme declared page templates it requires the_content(); function to present in the code.
Issue #1: WooCommerce uses the woocommerce_content(); function to return the content of the shop.
Issue #2: The Shop output does not use the "Page" or Custom Page template - the output is equivalent to the index.php or home.php, neither of which are editable via Elementor.
Unless you are willing to write a pretty sophisticated function to collect all those elements' data and filter them into the_content(); function, there is currently no way of editing such content directly.
I know it's not the solution you are looking for but that is the current state of affairs. Having said that, some of us are working on all sorts of solutions and maybe, just maybe - we'll come up with a way to have this option available soon ;)
For shop page you should go to Elementor setting and then check products in post types.
Because shop page products are not the content but posts it's the solution.
So inlcude products in post types and edit with elmentor, if for some reason you can't see 'edit with elementor' under shop page, then just open shop page and add
/?elementor and it would enable elementor
NO need to add this code in any page follow these instruction.
You just need to clear cache and cookies your browser, Some time website take previous data to show the web page and give this error.
or
if you open your website private mode then login and go to the page by Elementor you will never face this problem.
i was wondering if you need or can make post templates for search results page only on wordpress. I'm developing my own child theme using underscores.me framework on localhost and have come across an issue which has lead me to ask this question. T
he issue itself is that the post content for post's (for both standard and custom post types) gets changed on the search results page to the url of the post permalink -
e.g. if i search for post titled movie3 it will return a result on the search results page, but the post movie3 will have the post body removed, including the excerpt and read more etc and instead have the title and date followed by localhost/?movies=movie3 instead of the excerpt or post body (I'm using optional excerpts), followed by tags etc.
This is the first time I'm developing with wordpress and was also wondering if a plug in like relevanssi would alleviate my issues, especially since I've read that wordpress search is supposed to be terrible?
If you are building your own theme I would not suggest using a plugin for this. The underscores theme should have an search.php page included in the wp-content/themes/yourtheme directory. This is the default template for displaying search results.
The default search.php template for underscore should have "the loop" included:
<?php while ( have_posts() ) : the_post(); ?>
You can call WordPress functions such as the_excerpt(); inside "the loop" to get the excerpt of the returned post. See http://codex.wordpress.org/Function_Reference/the_excerpt for more information on this.
I'm having a bit of trouble with Wordpress, I want my blog posts to show on the news page, so I selected that page in the settings tab.
The blog posts show but I want to change the page template, I created a new template which works on all other pages but when I select it from the page template list within the 'news' page it doesn't change but instead just stays the same.
There is no blog.php file, I've even tried changing the standard page.php expecting it to be falling back onto that but it is not! I've tried changing the archives page too but nothing seems to change it!
Any ideas?
It won't be page.php which shows a single page view and you're right, there is no blog.php. Wordpress uses a template hierarchy for displaying lists of blog posts.
As you can see from this diagram - Wordpress template hierarchy
For archives like your News blog page you are looking at category.php, archive.php and then index.php (depending on your theme and which template files you've got).
Rather handily your problem is exactly the same as the working example used as a demonstration in the Codex link I've given above, so this should help explain things more.
I've created an HTML page as part of my website which I would like to use as a template for news articles. The page has all the things it needs, it just needs to display the correct news article in it.
I installed WordPress on my webserver and now wonder how I can have wordpress publish articles using my HTML page?
Is this even possible since WordPress works with php?
thanks
What you are talking about is themes. Wordpress allows you to create a theme for your installation so it displays using your html/css (more or less)
The way I do this is copy the default theme and make changes in there, and then you can switch to your new theme in your settings.
Edit: in addition, you can also load up wordpress on any page using:
include( '/path_to/wordpress_install/wp-load.php' );
This will allow you to use wordpress functionality on any page of your site.
just edited the single.php file by pasting the desired html code and leaving the loop code there where the text needed to show up.
didn't need to break up the page in a header, body and footer. Left out sidebar for now, but will put it back after I edit it properly.
Currently there is a bug in WordPress if you have a Posts Page set under:
Settings->Reading->A Static Page->Posts Page
If there are posts, than the page (e.g. with a slug called news) displays the post, and uses index.php from the theme.
But, with this configuration, if there are no posts, then it calls the theme's 404 page. This is definitely a bug, and has been submitted (Ticket #10822). It should be letting index.php show whatever it wants upon !have_posts(), but right now the page doesn't seem to be called at all.
My question is: is there a workaround for this bug without modifying core wp files? I'd be open to a plugin, theme changes, a custom page template, htaccess changes, etc.
I just performed a test for it. It isn't actually serving a 404, it's using index.php but since no posts are found so it falls outside of the have_posts(). Are you sure it's not a plugin or theme causing your issue? I tested this with the default theme on a base install of WordPress.
Most theme files have as part of their WP loop a catch for no posts, i.e.:
<?php else : ?>
Sorry, but you are looking for something that isn't here.
<?php endif; ?>
That might be what you're seeing. You can use a custom page template without that text (leave the loop) for yoiur posts page. And try Reveal Template | coffee2code.com to find out what template file you're looking at.