Jump to content

cjc1867

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by cjc1867

  1. Hi The 'Repeater' would have been ideal but that comes with the Pro version and therefore you have to buy it and I can't afford it at the moment. Another Plugin I found is called 'Toolset' and that is ideal as it has a tutorial and it looks like it will do the job but when I tried to download it I couldn't because you have to buy it and there isn't a free version. At the moment what I have works but not ideal so I will have to look for another solution. Thanks for replying. Colin
  2. That's my problem, I don't understand how databases work in WordPress as it just looks like one table for all the posts and pages. Also I don't know how to create a table or series of in MySQL and pull values from it using PHP. I did databases at Uni but that's 20 years ago and I have forgotten most of it as I haven't done any since. The burial register has a set number of fields and I have been trying to put a database together in Access just to see how it works and then convert it using MySQL and PHP but haven't got very far. When I first started this project I just based each Custom Post Type on each Grave and then added the people who are buried in that grave but I can see now that I am missing information as I used Taxonomies to select the Vicar. So if I have several burials in a grave then I can only select the vicar once even if he buried all of them. I should have based it on the person buried and not the grave. I will look into creating databases in WordPress and yes you are right I could have retrieved the count quite easily and other information. Thanks for your comments. Colin
  3. Hi I need to know the amount of people so that the text says either 1 person or 2 or more people buried and it should come before I get to the loop. At the moment I have just added another field to add the total and then used an If Elseif statement but I can't see how I can count the number instead based on the loop. $people_buried = get_field('how_many_buried_in_this_grave'); if($people_buried) { if($people_buried == 1) { echo '<p>Listed below, is 1 person buried in this grave.</p>'; } else if($people_buried == $people_buried) { echo '<p>Listed below, are ' . $people_buried . ' people buried in this grave.</p>'; } else { echo 'Nobody buried here'; } } I suppose I will have to leave it like that as at the most is going to be 4 or 5. Cheers Colin
  4. Hi My PHP skills aren't that good but I know what I want to do as I have used other programming languages before. I run a WordPress website about a Church and its Cemetery. I have been researching the graves for the last 2 years and have added each grave to the website via a Custom Post Type with the buried occupants. In WordPress I have used a plugin called Advanced Custom Fields and have set each grave to allow at least 5 people buried there. So the following code below is used to check if the fields have any value which would represent each person in that grave and add it to the page. I don't know how to add it as a database table so this is the easiest way I could think of. echo '<div id="section-grave">'; echo "<h3>Who's buried in this Grave?</h3>"; //echo '<p>Listed below, are the people buried in this grave.</p>'; if(get_field('is_burial_date_known')) { // start For Loop for ($x = 1; $x <= 5; $x += 1) { $name_of_deceased = 'name_of_deceased_' . $x; $burial_date = 'burial_date_' . $x; $clergy_name = 'clergy_name_' . $x; if(get_field($name_of_deceased)) { echo '<p>' . $x . ') ' . get_field($name_of_deceased) . '</p>'; } if(get_field($burial_date)) { echo '<p>Burial Date: ' . get_field($burial_date) . '</p>'; } if(get_field($clergy_name)) { echo '<p>Buried By: ' . get_field($clergy_name) . '</p>'; echo '<hr>'; } } // end For Loop } else { echo '<p>Nobody buried here.</p>'; } echo '</div>'; I want to add a paragraph above which I have commented out to show how many people are buried in that grave. So if it was only one person then it should say 1 person as oppose to people. So I need a way of counting the names but I can't see a way how to do it. It will probably based on an IF...Elseif...Else statement and which ever condition is right it just displays the correct line or paragraph. I need a way of counting thetotal number of people per grave but outputting the total relies on the loop which is after the paragraph or line. I hope I have explained it properly so can anyone see how I can do it please? Colin
×
×
  • 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.