Wordpress create a new tab on post page - plugin - php

I was wondering if you could help me with my plugin.
I want to have another tab on the post creator page for example like the AddToAny plugin.
As shown in this picture:

First you must know how to do a Custom Post Type.
Here you have official docs : https://codex.wordpress.org/Post_Types
Second, you must know how to add a meta box.
Here you have the official docs: https://codex.wordpress.org/Function_Reference/add_meta_box
And here there is a good tutorial about meta boxes : http://code.tutsplus.com/tutorials/how-to-create-custom-wordpress-writemeta-boxes--wp-20336

Related

How to make options for each page in wordpress

I am creating Dynamic wordpress template to publish it on themeforest and other Marketplace and i want to add specific options for each page (NOT options page) this options will show and the bottom of Add new page .
i wanna ask what is the name of this function or how i can add options like in the photo
You can research more on using wordpress custom fields,
Here is a good tutorial https://www.wpbeginner.com/wp-tutorials/wordpress-custom-fields-101-tips-tricks-and-hacks/
you can use ACF (Advanced Custom Fields) plugin for it. It is easy to create option for page, post, custom post using it and It has very good documentation.
here is the link :
https://wordpress.org/plugins/advanced-custom-fields/

WordPress Customizing Custom Post Types?

I've been asked to add post section to a customers WordPress website. Being fresh to wordpress i'm new on the terminology of the features of wordpress. In the menu i can see the existing two items as follows:
They've got "Posts" and "Properties" and now they want to add something the same as "Properties" but a different category called "Properties for Sale".
In WordPress are these sections referred to as "Custom Post Types"? Am I right to just install a plugin and create a new Custom Post Type?
Any advice would be appreciated.
There are many plugins to create post types. Custom Post Types definitely does the job. Once you activate it you should be able to create your own post types.
If you don't want to use a plugin, there is a way to do it yourself either in functions.php or in your own plugin. For a beginner, however, using a plugin is the easiest way.
There already is a plugin of some sorts installed for this. The "Custom Post Types" menu item is not native to WP.

WordPress archive-custom.php page not working

I am new in WordPress.
I have a custom post type and from that custom post type, one post will show in home page, and below that post there is a link. When visitors will click on that link, it will take them in a page where all posts of that custom post type will show with pagination.
What I have done so far.
- Created custom post type.
Called one post in home page.( Upto that it's working fine. )
Created a archive-custom.php template.
But couldn't solve that link. Php the permalink doesn't work.
Also if I try to access the archive page by mysite.com/archive-custom.php no post shows there.
Search in Google, stackoverflow, wordpress codex . But unfortunately ended up with no result.
Any suggestions on how to solve this
Better way to develop archive page for a custome postype is, copy the code from archive.php (of coarse from your current theme folder) and paste it on newly created page "archive-yourpostype.php" . Then start tweaking on the code.
From your other post, your post type is called latestnews. When you look at the Template Hierarchy (which BTW you have to read thouroughly), you can create a custom archive page for your custom poist type. For this to work, has_archive have to be set to true when registering your post type.
Now, lets look at what is happening. You have a custom archive page, arhive-custom.php. When you directly access
mysite.com/archive-custom.php
It will fail, as it is wrong permalink structure.
Also, wordpress will look for the custom post type custom, which will outright fail, because that post type does not exist.
If your post type is called latestnews, then your archive page should be called archive-latestnews.php

How to display a wordpress custom post?

Okay, so I am completely lost on how to display a custom post. I've looked everywhere and can't seem to wrap my mind around it.
So, I downloaded the plugin Custom Post Type UI to create a custom post. Here are the parameters of my custom post type:
Name: discount
Label: Discount
Supports:
title,
excerpt,
thumbnail,
author
Then, I downloaded Advanced Custom Fields to give my custom post types some custom fields for users to edit.
I didn't have any problems with that. My problem is that I have no idea how to implement this into my site. I would like it to act exactly like a blog post and also implement a masonry for it - just like my blog posts (I'm using the dante theme (I can't post any more links)).
If anybody could help me out with this, or send me in the right direction, I would be so greatful. Thanks!
Your custom post type's theme template would be called "single-[post type name].php".
So for your example, you would want to create single-discount.php if your theme's root directory. Then you can start pulling your data from the posts through that.
For Advanced Custom Fields, you'll want to get familiar with get_field() and the_field(). ACF has great documentation on their site for how to use the various field types (http://www.advancedcustomfields.com/resources/)
To answer your questions in a general way, you could start by:
Theme Development. To understand how a WP theme works
Template Hierarchy. To understand what are the template files and how they are managed by WP
The Loop. To understand how WP shows the post
WP Query Class. To understand how to manage the posts, perhaps in the case of custom post type
For the custom fields, #Joe has pointed you in the right direction.
Hope it helps!

Wordpress custom page attribute

I'm working on a custom WP theme that displays all "pages" as sections in a one page layout.
What I would like to do is add a color chooser to the page designer, so that the user can choose a color to be the background color of that section.
I'm totally new to wordpress so I don't even know what files or functions to look at to add this behavior.
Is there perhaps a prebuilt plugin to do something like this?
Four options:
use a plugin like Advanced Custom Fields or Custom Content Type Manager
ACF has a Lite version to add the meta box programmatically
a helper script like Custom Metaboxes and Fields for WordPress
do it yourself, using this Q&A as example: Add a checkbox to post screen that adds a class to the title
Probably, you'd want to change the visibility of the meta box according to the chosen page template, refer to this Q&A: Custom meta box shown when template is chosen

Categories