Removing posted by and date from posts on wordpress - php

How do I remove the date added/admin/no comments section of each one of my posts in my wordpress blog here http://www.kvylfm.com

Edit your template file index.php and look for this snippet:
<div class="post-info clear-block with-thumbs">
when you found it, it would be something like this:
<div class="post-info clear-block with-thumbs">
<p class="author alignleft">Posted by .........</p>
<p class="comments alignright">.........</p>
</div>
Just remove it all.
If you don't know what template it is, on admin panel, look at Appearance » Editor.
You should see list of files on right side of that page. Just find 'Main Index Template' and edit it, look at snippet above then remove it.

Related

Changes to page.php and single.php not applying

I'm having quite a weird issue with my WordPress site. I am building a theme from scratch and I'm trying to make change to the containers on my blog page (page.php and single.php). Weirdly enough, I have made no major changes to the code other than add a wrapper, but the changes aren't showing up.
I've made many themes without this issue so I'm unsure what's going wrong this time. I have set the blog page to be the posts page in the settings so I can't understand why the template won't update. The code I have is below, and is just the standard WordPress code with the exception of 'grid wrapper' and attempting to remove the sidebar which also shows.
I have done quite a bit of research on this to see what the problem could be, but sadly the only post similar was in 2014 with no answer.
<div class="container main-content">
<div class="grid wrapper">
<section class="the-content">
<main>
<h1><?php the_title(); ?></h1>
<?php while ( have_posts() ): the_post(); ?>
<?php get_template_part('template-parts/content', 'page'); ?>
<?php endwhile; // End of the loop. ?>
</main>
</section>
</div>
</div>
Long story short, my content shows just fine. I just can't edit the wrapper which contains that content.
I would change parameters in get_template_part()
This is how it supposed to be used: Understanding get_template_part
So if you have blank Wordpress file structure, I'm not sure if you have template-parts for sure. You can have them only if you intentionally made them.
Use wordpress Wp-Super_cache Plugin
I had the same issue. Most likely index.php is overriding your file as in my case. It depends how your theme handles the loop so check out on your index.php and change it there.
If i remember well, the blog page set in the back-office reference first at home.php and then index.php. Page and single aren't call.

Editing a 'sidebar' in Wordpress

There seems to be a problem with something on my wordpress page as a widget isn't displaying but I'm not sure how to edit the widget.
The code on homepage.php under Appearance>Editor is
<section class="row post_content">
<div class="col-sm-8">
<?php the_content(); ?>
</div>
<?php get_sidebar('sidebar2'); // sidebar 2 ?>
</section> <!-- end article header -->
Where would I find the code for 'sidebar2' as at the moment an error message appears on the page where the sidebar should display
As outlined in the Developer handbook for get_sidebar(), your sidebar file should be called sidebar-sidebar2.php. This file will be present in the root directory of your active theme.
The get_sidebar() hook allows a specific sidebar template file to be used in place of the default sidebar template file. If your file is called sidebar-new.php, you would specify the filename in the hook as get_sidebar( 'new' ).

wordpress custom theme search has quantity but displays no results

Trying my best to wrap my head around wordpress search process and results.
Been reading and researching online for about 8 hours straight at this stage and have gotten almost nowhere.
I have a completely custom theme, designed by a friend for a client. I have a search box in a nav bar at the top of the page, inside the header. I'd like the user to be able to search the site's content from that search box in the nav bar at any time. I've found plenty of examples of this being accomplished on other pages, though they often seem to be using a ready-made theme.
Eventually I'd like to be able to understand what's going in the search.php file well enough to edit it along with the searchform.php file so that the search box and results appear unified with the rest of the theme.
At the moment the closest I've gotten to having anything functioning at all is the inclusion of a quantity of search results showing the appropriate number of hits expected, but I still can not figure out how to display a result.
I've been combing through others' page sources and every hit I can google about customising or just explaining the search.php file, and yet all I keep finding is "read the Creating a Search Page" and "it must be a theme issue." This is not gainful information.
My understanding of what's being taught in the "Creating a Search Page" info is that it describes the steps for creating a custom search page that one can hyperlink / permalink to, but which is unrelated to the default search function within the wordpress kit. Indeed, I've successfully created a custom search page, but it behaves simply as a stand-alone page, and is not related to a customised search results page. To customise the look of default search function results, I understand the search.php file must be edited. So far the "what to edit" within that file escapes me, but for now I'd just like to understand why I am seeing the correct number of results, but no actual results.
My search.php file looks like this:
<?php get_header(); ?>
THIS IS THE TOP OF SEARCH.PHP
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<h1 class="search-title">
<?php echo $wp_query->found_posts; ?> <?php _e( 'Search Results Found For', 'locale' ); ?>: "<?php the_search_query(); ?>"
</h1>
</header><!-- .page-header -->
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', get_post_format() );
endwhile;
/*
// Previous/next post navigation.
twentyfourteen_paging_nav();*/
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
THIS IS AFTER THE SECTION OF SEARCH.PHP
<?php
// get_sidebar( 'content' );
// get_sidebar();
get_footer();
*Note: The notes in CAPS are to help me understand what content is coming from where as I try to figure out what each phpiece of the puzzle is doing.
Also, the twentyfourteen_paging_nav line is commented out as it kept spitting back an error. The original search.php was from a (default theme?) folder called "twentyfourteen". My current folder is called "ewgi2014" however, replacing twentyfourteen_paging_nav with ewgi2014_paging_nav spat back the same error, and I can't find any more useful information on the topic. Also, when looking at other sample search.php files I didn't see the paging_nav call, so I tried commenting it out, and was able to at least avoid the error, though I still don't understand it.
Sample output on the page after searching for the term, say, "program" is:
8 Search Results Found For: "program"
...with nothing else written beyond that.
Not entirely relevant, I believe, but my searchform.php looks like this:
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>">
<label>
<input type="search" class="search-field" placeholder="search …" value="" name="s" title="Search for:" />
</label>
<input type="submit" class="search-submit" value="Search" />
</form>
I've read and re-read the "Creating a Search Page" page from the Codex so many times I could probably recite it by heart, but haven't found any solutions within.
I've read the stackoverflow hit about "How to display Wordpress search results?" and have tried the code from ThemeShaper, but that throws an error on the shape_content_nav line(s).
I've read this and ... and apparently I can't link to all the other things I've read as this is my first post, but I have been reading a lot, and fiddling, and making very little headway.
Apologies for the long-winded post. Just trying to be thorough and show my research and current point of understanding.
What happens if you put
the_title();
Directly after your while statement?
Each time you loop within the while loop, you are processing each post. Currently, on each loop, you are entering a content-*.php file, where * depends on the post format. Does that file exist?

Customize the cancel_comment_reply_link WordPress

As the title suggests, I want to modify or customize the cancel_comment_reply_link without editing the /wp-includes/comment-template.php.
The code in comment-template.php looks like this:
<h3 id="reply-title" class="comment-reply-title">
<?php comment_form_title( $args['title_reply'], $args['title_reply_to'] ); ?>
<small>
<?php cancel_comment_reply_link( $args['cancel_reply_link'] ); ?>
</small>
</h3>
Basically, I want to get the cancel_comment_reply_link out of the <h3> and <small>-Tags into a <div> container but I really don't know how to achieve this without touching comment-template.php.
Is there a solution to include into my theme's functions.php?
Thanks for any help.
I copied the complete comment_form function into my functions.php, renamed it, modified it and included the new function instead of the old one.

Wordpress yet another related posts plugin not outputting in specified location

I'm using the YARPP plugin for a custom hosted wordpress site. I've changed the default location settings so that it only displays the widget where I specify (see screenshot). When I call the plugin in my single.php file it is moving the widget inside of the article.post, even when I try and contain it in a separate wrapping div.
single.php:
<article class='post'>...</article>
<div class='yarpp-wrapper'>
<?php if (function_exists('related_posts') ) : related_posts(); endif; ?>
</div>
output:
<article class='post'>...</article>
<div class='yarpp-related'>...</div> <!-- yarpp plugin-->
<div class='yarpp-wrapper></div> <!-- empty wrapper -->
I believe it's because you are using a custom yarpp template. Select 'List' instead, leave the other options above unchecked, and make sure the php script is in your single.php file. No need to wrap it in anything. Just place wherever you want it to show.
<?php related_posts(); ?>

Categories