Tag Info

New answers tagged

-1

Make sure your user has permission to publish. Some WordPress setups users such as authors do not have permission to publish posts directly, instead they can submit them for review for an admin to review and decide whether the post should be published or not. It is not a great idea to use an administrator user on daily basis so sometimes people create an ...


1

You can't write this syntax directly to plain HTML code. ::berfore element is added to HTML tag only when it is defined in CSS stylesheet (like denis.stoyanov wrote).


1

Why do you need to manually enter it? The ::before and ::after are there even without declaration. li::before { some rules... } li::after { some rules... } Here is an article that describes it.


1

When adding an external link you need to include HTTP:// or HTTPS:// at the start of the URL to link to an external domain. Otherwise the link will be added onto the current domain.


0

use some thing like this $queried_object = get_queried_object(); $term_id = $queried_object->term_id; Most probably $term_id should give the id of the taxonomy term of the current page, try echo $term_id; If it doesn't then try using var_dump() like echo "<pre>";var_dump( $queried_object )echo "</pre>"; Analyse the output , and use it ...


1

You will create a page template whose file name is custompage-template.php here I suppose put in in your plugin dir/views/ folder. Whenever the page whose title is Your Page Name is visited, the site will render your custom template add_filter( 'page_template', 'fw_reserve_page_template' ); function fw_reserve_page_template( $page_template ) { if ( ...


1

You get that error, because the $_GET and $_POST are not filled on every admin page with that data. Also, your code should never rely on globals, they can be changed by any other code, so they are not reliable. So don't use global $post;, $_POST or $_GET when you can get the information from better sources like here. Use the action add_meta_boxes to … well ...


0

I have Found a way which I use regularly to add my own created PHP to a PHP PAGE or post through the use of Short Codes. Now Create a PHP page named example.php in your theme root directory. write something like: <?php echo "Hi! I am a PHP File in Wordpress template Folder!" ?> Now add the following code to your functions.php function ...


0

From what you describe it sounds like the 2 websites are entirely different systems. You can't just put a WordPress short code anywhere on other websites and expect it to show content from your WordPress site. If you create a blank page within your WordPress site and put the short code on that page you could then load that page using an iframe on your ...


0

Instead of page slug use page id like is_page(12) where page id 12 Edit Your code should work I afraid your page slug is not same, so it will be safe to use page ID instead of slug


0

I found your post when I was looking to do the same thing. I don't know if I am too late for you, but maybe someone else will benefit. I have used a simple, free, effective plugin called 'Page Links To' It puts an extra box near the bottom of each editing page, and defaults to 'its normal Wordpress url'. But you can change it to redirect to a custom url, ...


0

You can add categories and pages with a hook function add_taxonomies_to_pages() { register_taxonomy_for_object_type( 'post_tag', 'page' ); register_taxonomy_for_object_type( 'category', 'page' ); } add_action( 'init', 'add_taxonomies_to_pages' );


1

There is nothing build-in to create the drop-down for you, so you have to do it yourself. To get the needed information you can use get_post_types() to get the post types you want, set the $args parameter accordingly. Additionally make sure to set the $ouput parameter to objects, because you need the data provided - it defaults to names and then you will ...


1

I tested the query and it does work so the only thing I can spot that is misleading but not right is directly after you while() statement you have the_post(). This doesn't work in secondary queries, it should look like: <?php if( $subpages->have_posts() ) : ?> <?php while( $subpages->have_posts() ) : $subpages->the_post(); ?> ...


0

If you have the ability to edit your theme files, then Rarst's solution is the proper route to take. However, if you do not have the ability or are unsure how to properly edit a theme file, I have created a plugin here that will allow you to add content to the top or bottom of all your posts, pages, or both. This plugin gives you the ability to select ...


0

In WordPress 4.2 the editor was removed on whichever page was assigned to show Latest Posts for whatever reason. The following function below ( original solution found here by crgeary ) will re-add the editor and remove the notification: You are currently editing the page that shows your latest posts. Here's some information on the hooks used: ...


3

get_the_content( $more_link_text, $stripteaser ) get_the_content does not take a post ID as a parameter, it always refers to the current post. Also, don't use magic numbers or hardcode post IDs into your theme, it will break after an import/export or migration. Instead use get_page_by_title, which is not as bad: // get the post $post = ...


-1

Need to modify in code : <?php $post_1677 = get_post(1677); $contents = $post_1677->post_content; echo $contents; ?>


3

You can approach this by first using a database query to count the number of pages that are already using the template: $query = "SELECT COUNT(*) as total FROM prefix_posts as p JOIN prefix_postmeta as m ON p.ID = m.post_id WHERE p.'post_type' = 'page' AND p.'post_status' = 'publish' AND m.'meta_key' = '_wp_page_template' AND ...


1

The template for the page is called page.php and should be in the same theme folder as index.php (alternatively you can use the is_page() function to do a template inside index.php but it's more difficult and there's little point to that). Best way forward is to study an existing theme and figure how things work. A look at the template hierarchy should help ...


0

From what I understand you have a loop that displays up to 500 pages. If the page parent = 18219 than you want to query the tags for that page. As far as I know, by default WP does not allow you to tag Pages, only Posts. But let's pretend you have a plugin that allows you to do that... Inside your loop you can check to see if the page has a parent equal to ...


0

Make all user author to contributor. After no user post directly you blog but submit article for review. Only Admin can publish.


0

Yes, content is not showing in editor. And there is no content in any of template files as well. Actually Website pages are already built by someone, and I want to edit some pages content. I am site Administrator and have Administrator rights. Some pages have been built by administrator and I can edit content of these pages successfully. But some pages ...


0

The hook to use here is admin_notices. However in register_activation_hook and register_deactivation_hook it shouldn't be used because these function run when plugin activates and deactivates instance. A workaround it we use add_option when plugin activates and delete_option when plugin deactivates. Here is the code. Hopefully you will understand it ...



Top 50 recent answers are included