How Change Meta Title on Individual URL in Post Pagination Wordpress - php

I have site on wordpress, but i'am use automatic pagination every post.
On pagination, then I made an article so that all posts are visible with the url, example https://bisnis.cilacap.info/pertamina-ru-iv-cilacap-transfer-pertalite?singlepage=all. This url work and no error in cpanel.
But the Meta Title is missing, and I want to make it into existence. Can any friend help me and implement it in function.php

Related

How to resolve WordPress post permalink structure for blog post in version 4.8.2?

I have very unusual issue on my WordPress website. In most of the blog posts custom permalink is working but there are few posts which are not following permalink structure like following
This is the correct link structure to open the blog post :
https://www.knexusgroup.com/show/blog/how-to-win-at-real-time-marketing/
But you can access this blog post like following URL also :
https://www.knexusgroup.com/how-to-win-at-real-time-marketing/
Blog posts which are correct, when you remove /show/blog/ from URL it will reflect 404 error, but in this blog post, it is opening the blog post.
Can anyone help me here to understand the issue & how to resolve this?
Edit 1
I have found what is the problem, and is post attachment & post have same post_name. However this should be resolved by solution How to delete the permalink (landing pages) of image in the media library in Wordpress?
But this is not working in this scenario. We are using permalink structure /show/blog/%postname%/ and I've observed which posts have permalink structure, there is no edit option in media attachment.
With idea of comment, I and Jaswant came to know attachment have same post-name as parent post.
So we deleted attachment of that post by searching in media library, and re added attachment to post, it works, this also fixed permalink of attachment with custom permalink and parent post.
I found all duplicate URL by running MySQL query.
Look into the parent page for each of yours pages. if the parent page is "show" so the link will be show/yout-page.
I hope I've helped you

How can I get wordpress post pages to including post id in the permalink on customized wordpress theme?

I had a previous coder move my site from a custom cms to a custom wordpress theme.
Posts are shown correctly when there is no post-id in the permalink. However, I would like to include the postid on the site posts. My permalinks now look like www.website.com/post-title/ although I would like them to be www.website.com/123/post-title/. I believe all my issues are coming down to one function.
http://pastie.org/10498435
The code on that page does various things based on vars found in the url. I am not 100% sure if this is the only problem, but it is the only one I can find. I have a custom post type created on my site that seems to work fine. The permalinks seem to fully work. When visiting a post page with the postid in the url (changing it via the permalink settings) I get a 404 page. I also get a 404 page when I try and view the author page. I have no clue where to even begin to figure out what the problem is with the author page.
Site: http://www.frontdesktip.com/blog/

How do I show only one specific post with comments and author box on the homepage in Wordpress?

I want to show the full post with comments and author box on the home page just as if the actual link to the post was clicked. I will set the canonical on the actual post to point to the home page for seo purposes.
I've seen some code out there, but so far nothing that matches my exact needs.
I only want to display 1 WordPress post on the homepage with the comments and author box below the post. And I want to be able to specify which post will be the one that gets displayed on the homepage. (which post id#)
To add to this, I also need the rel="author" to be visible in the header section. I'm using WordPress SEO by yoast and have selected to not show rel="author" for pages. And all code out there I've tried that shows a single post on the home page treats it as if it is a page instead of a post, therefore removing the rel="author" from the head area.
Please do not reply with how to set the number of posts in the Reading tab or how to set a static page. I already know that. That won't work for my needs.
In summary, when I go to my home page I will see the article I wrote along with the comments and author box below it and rel="author" in the header.
Your best bet would be to set your homepage as a static page, and build a custom template for that page. In the editor, create a custom field that allows your to select a blog post to feature (look into Advanced Custom Fields plugin for easy custom fields), grab that custom field value, and use that to build either a WP_Query, or just call the various bits of information using the ID of that post. The trickiest part is getting the_content() by ID. Here's how you can do that:
Add this function to the functions.php file:
function get_the_content_by_id($post_id) {
$page_data = get_page($post_id);
if ($page_data) {
return $page_data->post_content;
}else{
return false;
}
}
Call your function in your page template like this:
echo get_the_content_by_id([INSERT YOUR DESIRED POST ID HERE]);
If you make a php file in your Theme directory called front-page.php, that will automatically appear as the template for your static home page.
Now as far as the rel="author" thing, I don't know anything about that, so I unfortunately cannot help with that.
Also, I'm unsure why my code is losing it's formatting here.

Wordpress Custom Permalinks for a Category whose Posts are automatically generated

I recently added a functionality to allow Twitter to create blog posts automatically whenever a new tweet is posted. As I'm using Wordpress Jetpack Publicize so I wanted the title of the posts to be the full tweet, that way it'll automatically update all my social channels.
As the permalink setting I'm using %postname% for all posts but in case of Twitter posts it gets way too long and creates issues with Backup and other things.
The Twitter post is assigned to a category Tweets so I want wordpress to set custom permalink for the same category posts. How can I do that?
You can see the twitter posts at my blog - http://robo.im/blog
I'm using Wordpress Plugin Twitter Tools to fetch the new Tweets
Just set the custom premalinks to /%category%/ here you can read what to do if posts have multiple categories.
But if not change urls for all categories, use custom post type instead of category, and follow one of many tutotrials how to change permalinks for that type.

How to get right link (permalink) to a exact wordpress post?

I have a website that is a custom PHP site hosted at http://mysite.com. Then I have a Wordpress instance running on sub-domain at http://blog.mysite.com, where some post can be at URL http://blog.mysite.com/this-is-my-test-post-entry
In landing page of mysite.com I connect to Wordpress DB and fetch out last 5 entries from wp_posts table and show them on my home page. The problem is I don't know how to get the right links to those posts? Wordpress generates permalinks() but I don't know how to get them?
I thought Wordpress takes post title string and replaces spaces with "-" and uses that string for post URL. But doesn't work for all posts...
Any suggestions?
This may not be exactly what you are looking for, but it will work...
When you fetch your last 5 posts, get the id (make sure you're filtering on your post_type field to avoid grabbing things like revisions, attachments, etc).
You can simply build your URL like http://blog.mysite.com/?p=ID (where ID is the ID from the database). WordPress will automatically redirect the user to the proper page with the custom permalink that you defined in your settings.
Let me know if you need a hand with the PHP.

Categories