Jump to content

binga30

New Members
  • Posts

    4
  • Joined

  • Last visited

binga30's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. How can i get the post_id by calling wp_posts.
  2. Hello, I have 2 tables that each contain some data that is related. It's using wordpress and is referenced as follows: Table: wp_posts ID: 1 Table: wp_postmeta post_id: 1 The ID and post_id numbers correlate for each post. I need to grab data from the meta_value column in the wp_postmeta table by referencing the wp_posts table. I am using a premium theme which for some reason just returns blank when trying to call the data direct from wp_postmeta, yet when I echo different column data from wp_posts all is dandy.
  3. Thankyour for the reply. I guess the steps I have at the moment are: 1. show the tags in a dropdown with the corresponding tag as the selected option (ie- if first tag show the tag dropdown list with tag1 selected, and if there is a second,third or fourth tag, show each of them in a dropdown list with corresponding tag selected). 2. if a change is made to the tags selection, then update this to the DB to save the value. 3. be able to add a new dropdown with the tags if the user would like to add another tag, upto a maximum of 5. So if I were to focus on step 1, here is my current code: // CUSTOM GET FOR TAGS if(isset($_GET['eid']) && $field['name'] == "tags") { $tags=""; $alltags = get_tags(); $posttags = get_the_tags($_GET['eid']); foreach($posttags as $tag){ $selectedtag = $tag->name;} echo '<div class="tagsdrop">'; if ($alltags) { if ($posttags > 0) { foreach($posttags as $tag) { echo " tag is: " . $tag->name ; echo ''; foreach($alltags as $tag) { if($tag->name == $selectedtag) { echo ''.$tag->name.''; } else { echo ''.$tag->name.''; } } echo ' '; } } } echo '</div>'; //end tagsdrop $FIELDVALUE = $tags; } elseif(isset($_POST['action']) && (isset($field['dataname']) && !isset($data[$field['dataname']]) ) && isset($_POST['form'][$field['name']]) ){ $FIELDVALUE = $_POST['form'][$field['name']]; } elseif(isset($field['dataname']) && isset($data[$field['dataname']])){ $FIELDVALUE = $data[$field['dataname']]; } I am editing a theme and have only added the code between "$alltags = get_tags();" and "echo '</div>'; //end tagsdrop". Currently my output is 2 dropdown lists, as there are 2 tags on this particular post. Each dropdown lists all the tags, but the selected tag in both dropdowns is the 2nd tag alphabetically for the post. I am wanting tag 1 to be selected in the first tag dropdown, and tag 2 to be selected in the second tag dropdown. Apologies again for the long winded explanation, I feel like my solution is close but just needs modifying by an expert. Thankyou for your help.
  4. Hello, My name is Steve and I just joined up here. Looks like a good community so far. I am learning PHP and use Wordpress alot and I would like some help with an issue I'm having. Apologies if this is in the wrong section. I would like to output tags that I have preset in the backend, into a dropdown list on the frontend. Think of a profile page where a user can select an option from a dropdown, well I would like the tags to appear here for the user to select from. There are however a couple of requirements. If the user changes the dropdown value it needs to submit this to the Database so that the value is set to the new option. Also if a user wanted to choose more than 1 tag up to a maximum of 5, how could I add into the code if the user clicks a small link, another dropdown appears for them to select from the tags, and then save this to the Database as well. To me this seems like a highly advanced thing to accomplish, but to you guys this may be quite easy. Any tips, suggestions or links will be greatly appreciated. Thanks, Steve
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.