display condition with css in wordpress website - css

I have a WordPress website and in my website I have two fields for which I want to write a condition with CSS that if the user is logged in, the field will be displayed, otherwise it will not be displayed.
thanks for your help..

Check for this class in the body tag:
.logged-in
It's a class Wordpress will add if someone is logged in. Note that not all themes may support this.
Then, use that in your css selector:
.logged-in #my-div { display: block } //or whatever display you want

Related

hide button in css for all posts from specific wordpress category

I use this code to hide a button in css. It works. Is it possible to hide the button in a specific wordpress category posts?
div.screen-reader-text3
{
display:none;
}
any help appreciated
Yes. Wordpress adds class to body element on category page.
If you inspect your code on category page you'll see something like this in body class:
archive category category-skincare category-2.
The skincare it is a slug of my category, in your case it will be different.
You need to copy category-skincare and use it in your CSS like so:
.category-skincare div.screen-reader-text3 {
display: none;
}
Each page in wordpress have personal ID. If you inspect the page source via console, you can see in body this:
<body class="home page-template-default page page-id-58">, where page-id-58 - the unique page id.
In css it's look like that
.page-id-58 div.screen-reader-text3 {display:none;}

How do i remove gravatar completely from wordpress?

Hi I'm trying to to remove gravatar completely for my website. I've already disabled gravatar on the discussion page setting of wordpress. However, I'm using a paywall plugin which uses gravatar (called memberful) and its account popup always shows the profile avatar regardless if its disabled or not on the discussion page.
Example:
I think the profile-window is actually an iframe...
To here: https://dylogue.memberful.com/account/subscriptions
Do you have access to this endpoint, or is it created by a script? Changing the general CSS wont help you if you do not have access to inserting css into this endpoint.
The stylesheets are in weird places:
https://d1zgk03a9fsd43.cloudfront.net/assets/reach/style-4556bac86321e164130eb81bc9c1bd3e8ad4f00e3a7f1b803ef1e7e272baf184.css
https://d1zgk03a9fsd43.cloudfront.net/packs/member-bafbfb186fc0b252fb994416a369b793.css
I didn't see the link to create an account and test this, but does this CSS work?
.memberful-account-header img {
display: none;
}
.memberful-account-header hgroup * {
margin-left: 0 !important;
}

Trigger a class to hide meta-data of posts on WordPress blog page

Basically on my bakery's WordPress blog page http://www.omigretchen.de/novedades/ I would like to hide the meta data displayed below each post preview. Usually I always succeed in using the console and trigger the class.
As it shows in this case I use a display:none on the class .entry-meta. Nevertheless it does not work. Does anyone has an idea what to do?
Are you certain that you've added .entry-meta { display: none; }? Because I don't see it. Make sure you put it where it'll be printed to the page.
A better way to do it is by editing the archive.php and either remove or comment the code that prints the entry-meta block.

How to create a landing page with the child theme

I have purchased MasterStudy theme for my website and It doesn't have a template with no header or footer to create a landing page. My question is: how can I create a page with such template via its child theme and use visual composer to add the content? Is this possible?
Not sure if I completely understood your situation, but I'll try to help anyway.
Have you checked all the Theme Options? Sometimes you can easily delete the footer and header through the Theme Options. In case you have and there's not an option to do so, the smart move would be to create a custom page to fit your needs. You'll find some information about how to do so right here http://www.wpbeginner.com/wp-themes/how-to-create-a-custom-page-in-wordpress/
Remember that the visual composer only edits the content of the webpage per se, meaning, it can't modify the template structure (footer and header in this case).
Hope it helps!
Actually, the solution is much more simple than I thought. I resolved it by adding custom CSS to hide the header and the footer of the page by mentioning Its ID. Here is the Code I used >>
.page-id-2114 #header {
display: none;
}
.page-id-2114 footer {
display: none;
}

How to change default wordpress logout template?

I am new to wordpress development and now I am stuck.
I need to change style and add some buttons in default wordpress logout template (when i am redirected to http://example.com/wp-login.php?action=logout ).
But the question is where i can find that template?
Thanks in advance.
Regards.
Ivelin Georgiev
Right...
There (unfortunately) isn't a template page for the login page. I'm not sure why this is, maybe its for security or something, I dunno. In any case you can't edit it directly without messing with the wordpress core.
However there are various hooks and actions you can add to in order to do some customisations. Here is some sample code from my own applications:
// this adds stuff to the head. You can add a stylesheet
// if you want, or just css like I have.
add_action("login_head", "cust_login_head");
function cust_login_head()
{
// this just changes the logo
?>
<style>
body.login #login h1 a {
background: url('<?=plugins_url('images/logomed.png',__FILE__)?>') no-repeat scroll center top transparent;
height: 64px;
width: 307px;
margin-left: 10px;
}
</style>
<?php
}
// these change the default links from wordpress to whatever you want
add_filter('login_headertitle', create_function(false, "return 'http://website.com';"));
add_filter('login_headerurl', create_function(false, "return 'http://website.com';"));
Stick that into your functions.php file in your theme to get it to work.
There will be other such methods and hooks you can change and add to, you just need to find them.
Use Themed login plugin - It allows to make login and registration process themeable using site's theme.

Resources