top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to protect a webpage with password in wordpress?

0 votes
34 views
How to protect a webpage with password in wordpress?
posted May 9, 2017 by Navya

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

When you writing posts, there is an option called Visibility, which is set to Public by default. If you click Edit, then you will see options such as Password Protected and Private. Simply click on Password Protected to add a password to your post. Doing so, only the friends, family members, or users you share this password with will be able to see this post.
A private post in WordPress is visible only to logged in users with the Editor or Administrator level user role in WordPress.

When you writing posts, there is an option called Visibility, which is set to Public by default. If you click Edit, then you will see options such as Password Protected and Private.

answer May 16, 2017 by Arun Angadi
Similar Questions
+1 vote

I am working on a Wordpress project. I have a layout like shown in below the screenshot with a select field and boxes with news (two or more different post types). I want to filter with the select the post type so there should show up only the selected. How can i do that?

Screenshot :
enter image description here

0 votes

I want to parse xml for getting element with same attribute and display it into my wordpress post using shortcode by php.
I create a xml file called emp_test.xml

<?xml version="1.0" encoding="utf-8"?>
<all_emp>
<emp_detail>
    <emp emp_name="john"><img>john_1.jpg</img></emp>
    <emp emp_name="john"><img>john_2.jpg</img></emp>
    <emp emp_name="john"><img>john_3.jpg</img></emp>
    <emp emp_name="marry"><img>marry_1.jpg</img></emp>
    <emp emp_name="marry"><img>marry_2.jpg</img></emp>
    <emp emp_name="david"><img>david_1.jpg</img></emp>
</emp_detail>
</all_emp>

I create shortcode in functions.php to get all img has attribute is john:

function create_shortcode_empimg() {
$url = 'https://.../emp_test.xml';
$xml = simplexml_load_file("$url") or die("Error: Cannot create object");
foreach ($xml->xpath("//*[@emp_name='john']/img") as $node)
{
    $img = (string) $node;
    return $img;
}
}
add_shortcode( 'empimg_shortcode', 'create_shortcode_empimg' );

I use this shortcode into my wordpress post.

But, the reult is comming like this:

john_1.jpg

How to get all img has attribute is john like?

john_1.jpg
john_2.jpg
john_3.jpg

Anyone's help is appreciated.

0 votes

I am trying to convert an jpg image on my Wordpress blog to base64. I use this php code but it's not working:

$thePostThumb = get_the_post_thumbnail($postId, array(150,150));
background-image: url(\'data:image/jpg;base64,' . base64_encode($thePostThumb) . '\');

I have also tried this method:

$type = pathinfo(get_the_post_thumbnail_url($postId, array(150,150)), PATHINFO_EXTENSION);
$data = file_get_contents(get_the_post_thumbnail_url($postId, array(150,150));
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data)

I know the thumb image is being retrieved, just can't get it working. Anyone know what might be going on.

0 votes

I building a website on Wordpress. When I add this below code

$(document).ready(function() {  
$('#readerareaimg img').each(function(){
var filename = $img.attr('src')
$img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
$img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
});  

My website will generate alt and title tags automatically on images based on their file name, but I want to add any word or text before the file name. For example file name is phoneimg.jpg and it will display alt="phoneimg", but I want that alt to become alt="read phoneimg". How can I do this?

0 votes

I try to get wordpress list categories with count at the end of each category's name by input the parent category as output.

Ex: I have a parent category name "alpha", and its child categories name are, Category A, Category B, Category C, Category D

I want the output display:

-Category A (5)

-Category B (2)

-Category C (6)

-Category D (7)

<?php
    $variable = wp_list_categories( array(
    'show_count' => true,
    'orderby'    => 'name',
    'style'      => 'none'
    ) );
    echo $variable; 
?>

The result of the above code display categories with the count of posts at the end, but it display all categories. Can anybody help me how I fix this problem?

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...