I am Making a blog site. I want to show all posts of a user by linking with his/her user name. But it's not working. My code is
by <?php the_author();?>
What's wrong with it actually?
Try this :
<?php the_author(); ?>
Related
I have a problem with usersultra plugin for wordpress.
I have created a template page for search, but i only want to display it for the client who is logged in, how can i use usersultra for this case.
Secondly when i check 'Only Logged in Users' checkbox in page settings it displays the content of my page and form of registration at the same time.
Please how can i resolve this problem.
EDIT :
this is what am trying but it doesn't work
<?php echo do_shortcode("[usersultra_protect_content display_rule='logged_in_based' custom_message_loggedin='Only Logged in users can see the content']
<b>myfield :</b><?php the_field('myfield');?>
[/usersultra_protect_content]"); ?>
it only shows the text not the value.
EDIT 2 :
it worked with the code Ahmed provided
<?php echo do_shortcode("[usersultra_protect_content display_rule='logged_in_based' custom_message_loggedin='Only Logged in users can see the content']
<b>myfield :</b>".the_field('myfield')."
[/usersultra_protect_content]"); ?>
You can do that via this shortcode,
<?php echo do_shortcode("[usersultra_protect_content display_rule='logged_in_based' custom_message_loggedin='Only Logged in users can see the content']Your private content here [/usersultra_protect_content]"); ?>
The shortcode is listed here on documentation page : https://usersultra.com/userultra/
I have a question, and i hope i am posting in the right place, if this topic belongs to another forum, please guide me where to post it.
the question is: i have a website created with WordPress and i am using the Jupiter theme, i need to hide some content (like hiding the last half of the article in a page) and disable the photos to be enlarged unless the visitor is a registered user, i need to know how to do that, and if there is a plugin to do that, i have tried "layered-popups-for-wordpress" and "optin-content-locker-layered-popups-addon" but they didn't work properly.
It might request a lot of effort for you to edit the theme on your own...You can use the_excerpt() insetead of the_content() for display info, and add a rule that only registered members can see, something like
if(is_user_logged_in()) {
the_content();
} else {
the_excerpt();
}
Do this while in the loop, of course...
These plugins might help you though
https://wordpress.org/plugins/tags/paid-content
If you're using WPMU might try this one
https://premium.wpmudev.org/project/pay-per-view/
I don't know of a plugin that does this automatically, but you can do it yourself if you are willing/able to do some minor theme development. Make a child theme of your Jupiter theme, and copy over the file content.php. There will probably be some part of the code that looks like this:
<?php if ( is_search() ) : ?>
<?php the_excerpt(); ?>
<?php else : ?>
...
Or something like that. The point is, the theme should already be set up to serve excerpted content for a search. You could either simply add code like this:
<?php if ( is_search() || !is_user_logged_in() ) : ?>
<?php the_excerpt(); ?>
<?php else : ?>
...
Or you could customize what non logged in users are seeing like this:
<?php if ( is_search() ) : ?>
<?php the_excerpt(); ?>
<?php else if (!is_user_logged_in()) : ?>
<!-- Your custom code display here -->
<?php endif; ?>
Hope that's helpful!
In order to hide certain parts of your content with just a simple shortcode you may give "Restrict Anonymous Access" plugin a try:
https://wordpress.org/plugins/restrict-anonymous-access/
Examples:
[member]My restricted content …[/member]
This shortcode can be placed wherever you need to hide something from logged-out users or even users of a certain user role can be addressed:
[member role="author"]My restricted content to users below author role …[/member]
I have the following code to generate the link to the author on a category.php page:
<?php while ( have_posts() ) : the_post(); ?>
....
<?php the_author_meta( 'display_name' ); ?>
....
<?php endwhile; ?>
Unfortunately, the link get an empty href attribute. The display name is populated properly. I am using the latest WordPress.
That won't point to the author archive. It'll point to the author's URL as specified in their profile settings under the WP admin dashboard. So if a user hasn't provided a URL then it will be empty.
It is because the USER haven't provided his URL (this is author url) according to the code.
Check in Wordpress Admin > Users > All Users > choose the user and edit the URL for the particular user and check.
It will show up.
Hope this helps you.
I have followed all instructions on installing Disqus commenting system on my website but the old comment form is still visible.
My question is: is <?php comment_form(); ?> enough to display the comments or there needs to be something else on the single.php page.
What else should I be taking care?
I don't have any other commenting engine installed.
Thank you
OK I found it.
Instead of using the <?php comment_form(); ?> I had to use <?php comments_template(); ?>.
That did the trick
install woody snippets on your site
insert a new php snippet:
comments_template(); ?>
go in widget select custom html and place the code:
<div id="disqus_thread">
[wbcr_php_snippet id="THE ID WHAT WOODY GAVE YOU"]
</div>
and place the widget where you want
obviously don't forget to enable comments site-wide
I've been programming for like 5 straight hours and my brain has kinda stopped functioning.
I can't remember how to do this:
There is a page called Blog on my website, and I need to show all posts from my blog on that page. The Blog page is using custom template... Therefore, it's not index.php...
Please help me, I'm lost :/
Include loop.php in your template. That is what gets and displays posts.
To show blog post on a custom markup template, you can use this procedure, to loop if there are any posts and print them via the_content function.
<?php
if (have_posts()) :
while (have_posts()) : the_post();
the_content();
endwhile;
endif;
?>