{"id":54339,"date":"2017-06-05T16:54:35","date_gmt":"2017-06-05T19:54:35","guid":{"rendered":"https:\/\/wiki.samuelchopard.ch\/?p=54339"},"modified":"2019-03-18T14:29:21","modified_gmt":"2019-03-18T13:29:21","slug":"change-css-when-user-is-logged-in","status":"publish","type":"post","link":"https:\/\/samuelchopard.ch\/wiki\/library\/change-css-when-user-is-logged-in\/","title":{"rendered":"Change CSS when user is logged in"},"content":{"rendered":"<p><!--more--><\/p>\n<p>In your <a target=\"_blank\" href=\"https:\/\/samuelchopard.ch\/wiki\/library\/download-blank-child-theme\/\" target=\"_blank\" rel=\"noopener noreferrer\">child-theme<\/a>&#8216;s <em>functions.php<\/em>, paste the following code:<\/p>\n<pre class=\"EnlighterJSRAW\">add_action('wp_head', 'add_css_head');\nfunction add_css_head() {\n     if ( is_user_logged_in() ) { \n     ?&gt;\n          &lt;style&gt;\n               .sellertitle {\n                    float: left;\n                    width: 49%;\n               }\n          &lt;\/style&gt;\n     &lt;?php\n     } else {\n     ?&gt;\n          &lt;style&gt;\n               .sellertitle {\n                    float: none;\n                    width: 49%; }\n          &lt;\/style&gt;\n     &lt;?php\n     }\n}<\/pre>\n<p>Change the CSS as needed.<\/p>\n<p>&nbsp;<\/p>\n<p>Source:\u00a0<a target=\"_blank\" href=\"https:\/\/wordpress.stackexchange.com\/questions\/181630\/change-css-when-user-is-logged-in\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/wordpress.stackexchange.com\/questions\/181630\/change-css-when-user-is-logged-in<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"In your child-theme's functions.php, paste the following code: add_action('wp_head', 'add_css_head'); function add_css_head() { if ( is_user_logged_in() ) { ?&gt; &lt;style&gt; [...]","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[69,165,166],"class_list":["post-54339","post","type-post","status-publish","format-standard","hentry","category-php-tricks","tag-css","tag-logged-in","tag-logged-out"],"_links":{"self":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/54339","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/comments?post=54339"}],"version-history":[{"count":1,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/54339\/revisions"}],"predecessor-version":[{"id":54875,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/posts\/54339\/revisions\/54875"}],"wp:attachment":[{"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/media?parent=54339"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/categories?post=54339"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/samuelchopard.ch\/wiki\/wp-json\/wp\/v2\/tags?post=54339"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}