i want to have a content type with a phone number field that user can select it be shown to all or not. so i need a field after this field in add content page to give the user this option. but how can i check if user has checked it and then show the phone number in view page??
do i need some php coding for it?
You just need to create a custom template for your content type :
http://drupal.org/node/17565
Or a custom template for your phone cck field :
http://drupal.org/node/62466
In this template you will display phone field depending on the value of the other field, you will need a little bit of php code.
Install Conditional fields, and then set the Make phone number public? field as the trigger field and Phone number filed as the dependent field.
So that only if the first field is set to yes, phone number will be displayed.
Related
I have checkout page in woocommerce at the following link:
https://combosports.com/checkout/
Now the problem is I want the phone field to be marked as required as other fields. How can I make this phone field mandatory. I have tried through the theme options but it does not work through it. I also want the optional text removed from the field and add asterisk mark on it. Please tell me how can I do that. Thank you in advance.
This is the pic of phone field I have marked as required in theme options but it does not work
Full page pic
So I will preface this with being new to Wordpress/ACF but can do the basics.
I can set up fields and post types and query through them and do loops.
This I am not sure how to do.
I have a post type of properties that each have an assigned contact our of 3 people. I would like to enable to client in the backend when creating a property to be able to choose the assigned contact from a dropdown menu or a set of checkboxes.
That when a visitor clicks on that property the front end displays the contacts name email and phone number which are fields from the contacts bio post type.
I have a relationship field set up to go through the Bios and return the IDs but not sure where to go from there.
Thanks!
Base Fields For Contact Bio
If relation returns selected post's ID you can easy use get_fields($post_id) or get_field($key, $post_id).
I am looking to hide/show some fields depending upon user selection on another field. So a user can select among four wheeler/two wheeler. If user selects four wheeler from a dropdown he is shown different set of fields and for two wheeler different set of fields . As there are many common fields I am looking to use same content type for both content type
What I have tried so far is
Theme_name_form_alter hook in theme_name.theme file
As well as hook_form_FORM_ID_alter
None seems to be working for me
while Conditional Field module still is in development on Drupal 8 So
Field Formatter Condition Module could be a good choice.
Simple conditions and actions
Hide source field when target field is empty. Hide source field when
target field is not empty. Hide source field when the current user has
specific roles. Hide source field on specific pages. Hide source field
when target field contains a specific string. Hide source field when
target field doesn't contain a specific string. Hide link field if
title is empty. Hide date field if smaller/greater then today/custom
date. Hide if content from author Hide if checkbox is checked (in
current dev version)
Module conditional fields is still dev for Drupal 8 but should work:
https://www.drupal.org/project/conditional_fields
And in case "Conditional fields" is not working for you maybe "Paragraphs" can jump in as replacement. It's stable at least.
https://www.drupal.org/project/paragraphs
Not exactly what you were asking for, but can do the job.
I have added two field using "Advance custom field" plugin. i can see the value of the custom field value in the post but problem is that how can i get that values,i have attatched the screen shot. please see the screen shot and give me some instruction that how i can get that values.
In the backend custom field menu you was added this two fields please see that what slug is generated for that field and pass that slug in function
get_field('slug');
the_field('slug');
Reply if you understand or need more clearification..
I've just started using D7 and was trying to set up a system where people can add a couple types of content and associate one with the other via nodereference.
I only want users to be able to see and work with their own content.
To achieve this in D6 I used a view for nodereference.
In D6 I used argument : user: uid and if there is no arg, it uses the user id of the logged in user. This would return all of the content that was authored by the user.
I haven't been able to figure out how to do this in Views 3?
got it:
you first need to add a User relationship, then you will see new filters and contextual filters - one of which is "current user" or something like that
This five minute video shows how to do it, as well: http://nodeone.se/sv/node/684
With contextual filters you can also display the list as a tab on each user page (as shown in the screencast).
If you're interested in a list that always shows the current user's posts, you can use a standard filter instead – there is a "current user" filter available.
Edited: The original link is broken. I'm not sure which video it was, but it could be one of the following (which all deal with this topic).
https://vimeo.com/22276809 Video guide
https://vimeo.com/33588889 Exercise description
https://vimeo.com/33588956 Exercise solution
For drupal 7
Steps for doing as the above question are
Create a new content view and limit it to the content type you want.
Uncheck "Create a page" and check "Create a block." Select the format you want; I recommend an HTML list of linked titles. Click "Continue & edit."
Add a contextual filter for "Content: Author uid."
Under "When the filter value is not available," select "Provide a default value," and select "User ID from URL" from the dropdown. Because blocks don't understand contextual filters very well, the view won't work properly without this default value, and all posts of the given content type will show on all user pages (not just the user's own posts).
Under "When the filter value is available or a default is provided," check "Specify validation criteria" and select "Basic validation" as the validator. Select "Hide view" from the dropdown.
Save your view.
Assuming that you created a block display, the block will now be available on the Blocks page. Go there and open it.
Set your block to display on all user pages (/user/*) in the correct region. Save the block.
Your block should now appear on all user pages, showing the content written by each user.
Source