I'm new to php coding and I need to fix a bug in my friend's website. Here is the page with the bug http://www.corectura.ro/category/in-presa/ (it's in Romanian, but it doesn't matter). "Citeste mai multe..." is the "Read more..." link and it doesn't work. It just opens the same page (this one: http://www.corectura.ro/category/in-presa/) in a new tab, instead of opening the link/post in order to read more just as the "read more..." button says. The site is on Wordpress platform and has a custom theme.
I've looked into the editor in all the php files for the section where the "read more" is mentioned. I only found it in archive.php and styles.css.
In the styles sheet the only code i found is this one (regarding to the read more link)
.r_more{ display:block; text-align:right; }
And in the archive.php the code below:
<li>
<div class="post_thumbnail"><?php the_post_thumbnail('thumbnail'); ?></div>
<div class="post_content"><h3><?php the_title(); ?></h3>
<div class="date_post"><?php echo ucfirst(get_the_date('F Y')); ?></div>
<?php the_excerpt();
echo 'Citeşte mai multe...';
?>
</div>
</li>
Is there something wrong with this code? Is the syntax correct? Why does it open the same page in a new tab instead of opening the page with the content that's needed to be shown after clicking "Citeste mai multe..." ("Read more...")?
Please help. Thank you.
You are using echo, so you need to change the_permalink() to get_permalink() (which returns the permalink):
echo 'Citeşte mai multe...';
Try this instead:
<?php the_excerpt(); ?>
Citeşte mai multe...
Related
I am using Primal wordpress theme for the purpose of a simple blogging website.
I want to make a minor change on the home page. I want to remove the "Date, user and comment" line displayed below the title of the each post. I am not able to remove that from the dashboard. Kindly suggest solution. Suggest steps if it requires plug-in modifications.
I want to remove text highlighted in yellow
go to your \wp-content\themes\primal\template-parts\content-single.php
then find the code and comment it
<!--div class="entry-meta">
<span class="date-structure">
<span class="dd"><i class="fa fa-calendar"></i><?php the_time(get_option('date_format')); ?></span>
</span>
<?php primal_author(); ?>
<?php primal_comments_meta(); ?>
<?php primal_edit() ?>
</div--><!-- .entry-meta -->
then save the file
It will work for you.
Thanks
The website is http://www.mercuriusresearch.co.uk which runs on Wordpress and based on Bootstrap.
The error shows when you resize the screen below 768px, all the post title links stop working. The actual HTML is still showing the href but the post titles just behave like normal text.
The error is displaying across the website (i.e. on all post title links) but only on those sections of the page that are taking links from Wordpress. For example, the sidebar links on my homepage work on all screen sizes.
I haven't had this problem before. My suspicion, based on the previous paragraph, is that it relates to Wordpress somehow...but I am using the same code that I always use to bring in the titles from Wordpress. So that, and the fact that the error appears to relate to the size of the screen, leads me to think that Bootstrap is somehow related too.
Any help would be much appreciated.
The only code that isn't on the website is this, which is the Wordpress loop:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="post-date">
<?php k99_relative_time(); ?>
</div>
<div class="post-title">
<?php the_title( sprintf( '<h3 class="entry-title">', esc_url( get_permalink() ) ), '</h3>' ); ?>
</div>
<div class="post-excerpt">
<?php the_excerpt(); ?>
</div>
<div class="read-more">
Read more →
</div>
</article>
As I say though, this is working on larger screen sizes and if there was something wrong with this section, it obviously would occur on all screen sizes. All the other code is there on the website (obviously, I am not sure what part exactly is relevant, or I wouldn't I have this problem).
For a quick solution, you can write CSS using media query for devices below 768px and your links will work fine.
#latest-news-front,
#stock-ideas-front {
position: relative;
z-index: 10;
}
There is a div that covers all of the other divs you use.
If you look in your element inspector you can see the div.
You can float the sidebar-front div, but there is a change that other divs will behave different.
aside#sidebar-front {
float: left;
}
or clear every div by using the following code at the end of each one.
clear: both;
How can I display <?php the_content(); ? in a non-single page without the Read More link?
Basically I just need to get the part of the post before the more tag as I have a separate Read More button with a href="<?php the_permalink() ?>"
Most likely you either want to use
the_excerpt()
or
the_content(''); //'' tells it to have no text for the link
I'm currently using Wordpress and I have website listings that has link names as titles (eg. www.test.com, www.test2.com)
With this php code, it calls out the name of the website link:
<h3 class="list"><a class="h1" href="<?php the_permalink(); ?>"><?php the_title(); ?></h3>
Now that website has a "readmore" button and a "visit website" button. I'd like to turn the "visit website" button into a external link using PHP.
For example, the website listing is called "www.test.com". I'd like to turn the "visit website button" into an external link that will make it go to "www.test.com".
Here is my html code for the "visit website button":
<div id="visit">
Visit website
</div>
I hope someone can help.
Thanks!
I suppose you could do something like this instead
<h3 class="list"><a class="h1" href="http://<?php the_title(); ?>">Visit Website</h3>
If the_title is a valid URL starting with www (not http://), then it'll work. If they already have http:// in the title, remove that part.
Whenever you click a link you are visiting the url specified in href attribute.
For example to create a link, to go to google.com I would do this
Go to Google
So in you case you replace # with your link
<div id="visit">
Visit website
</div>
code it in php:All i can think of is this code:
<?php echo "<a href='http://www.test.com'>visit site</a>" ?>
I guess you are confused by
<?php the_permalink(); ?>
the_permalink(); calls get_permalink(); which finally provides the link.You can see its source code in wp-includes/link-template.php.
I'm trying to construct a Table of Content on a custom template in Wordpress. Because I already know beforehand the headings of the internal sections I want to link to I hardcoded that into the template.
My problem is that in Wordpress it doesn't scroll to that section at all? Here's the link to a page with an existing TOC section that's not working.
In terms of code, this is an illustration of what I got:
<div class="table_content">
<h4>Table of Contents</h4>
<ol>
<li>Overview</li>
</ol>
</div>
Which should link to an internal section with the code:
<h2><a id="#test_link" class="internal"><?php the_title(); ?></a></h2>
Note: I'm using "ID" instead of "name" because it's deprecated in HTML5, which is the doctype I'm using.
I'm also wondering is there an easier way of doing this with jQuery?
Any help in saving my hairline would be GREATLY appreciated...
Nevermind, I'm a muppet.
It's got nothing to do with doctypes or Wordpress issues. Just my incorrect, sleep-deprived implementation of HTML.
This
<h2><a id="#test_link" class="internal"><?php the_title(); ?></a></h2>
should be
<h2><a id="test_link" class="internal"><?php the_title(); ?></a></h2>
Notice the missing "#" in the "ID" attribute, removing that makes everything work nicely :)
You don't need the separate a element...
http://www.yourhtmlsource.com/text/internallinks.html