Tagged: access piklist fields from dynamic css stylesheet creator php file, dynamic css property value, dynamic styles, dynamic styles with piklist and php, implement external dynamic styles using piklist and php, pikist fields return nothing when called from style.php
- This topic has 3 replies, 2 voices, and was last updated 5 years, 9 months ago by
Steve.
-
AuthorPosts
-
-
May 10, 2016 at 7:17 am #6464
semwangajoshuaMemberI’m trying to access my Piklist created fields that I want to use in my style.php file so that when the user updates the value in that field from the dashboard of settings tab , the style.php file as well updates and thus generates the same value so that I can have dynamic css values where I need them. I’ve read in some of the posts here on the forum suggesting using Inline styles. I however don’t want to use Inline css styles because the dynamic css code to be used is big enough to make the code untidy if I mix it up in my template file. I thought that by being able to use php in my style.php file which writes/creates style.css, I’d be able to access my Piklist created values as well from that file (style.php) just like I do with normal database stored variables. So far, I’m able to generate the style.css file but when I try to use my piklist created fields that store the values I’d want to use, they return nothing and yet when I echo out the same variables on the page to check whether they return anything, they indicate that they actually hold the data I want to use because they print it out on the frontend. How in the world can access these piklist field values from inside thestyle.php file so that I use them to dynamically change the css property values basing on the data entered by the user into the settings pages or metaboxes?
-
May 10, 2016 at 10:34 am #6469
SteveKeymaster@semwangajoshua– How are you accessing the Piklist data? It should work the same as any other WordPress data.
-
May 10, 2016 at 10:47 am #6471
semwangajoshuaMemberI have the code below in my style.php file which generates the stylesheet file style.css
$profile1_color = get_post_meta ($post->ID, 'profile1_color', true); -
May 10, 2016 at 2:58 pm #6474
SteveKeymaster@semwangajoshua– This should work… but only when you are viewing that single post.
-
-
AuthorPosts
- You must be logged in to reply to this topic.