Forum Replies Created

Viewing 15 replies - 31 through 45 (of 67 total)
  • Thread Starter Freelancealot

    (@freelancealot)

    Perhaps some WordPress expert here can let me know if this statement is true, and if so, would making the CPT “hierarchical” => true fix that.

    “Custom Post Types don’t store post_parent for attachments”

    (https://wordpress.stackexchange.com/questions/184557/do-attachments-added-to-custom-post-types-have-a-post-parent)

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Thanks @aetherunbound. Do you mean that I would just swap $_REQUEST[‘post_id’] with $_REQUEST[‘post’]? Will give a try ?? and report back.

    Thread Starter Freelancealot

    (@freelancealot)

    Thanks for the info. I may not have explained so well. Step one, creating the conference CPT is done by me backend (I was going to use a form then decided against), so no need to worry about malicious stuff (hopefully).

    This is my code for creating the folder (it uses a post title). This is working fine, although I need to somehow replace the spaces in the title with hyphens.

    function run_on_conference_publish( $postid, $post ) { 
    $eventfolder = $post->post_title;
    
    $upload_dir = wp_upload_dir(); 
    $event_dirname = $upload_dir['basedir'] . '/papers/' . $eventfolder;
    
    if(!file_exists($event_dirname)) wp_mkdir_p($event_dirname);
    
    }
    add_action('publish_bafa_conference','run_on_conference_publish',1,2);

    The code you provided which is linked to the form pre-filter is for uploading the files from another form to the folder created in Step 1.

    So Step 2 will definitely be using the acf/upload_prefilter/name=my_file_upload hook within the my_file_upload_folder() you provided above.

    I will likely be back about the questions for the incremental file name prefix.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    That’s amazing. Thanks.

    I managed to get the first part done easily by hooking into the post publish action, so that when the post type Conference is published a folder is created in ../uploads/papers

    So now I have the folders being created it would be great if we could select or type that in your forms.

    In the meantime, I will try the code above and see what I can figure out with regard to the incremental number. I’m no coder really, so fingers crossed.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Sorry, I did not mark this as not support, and I can’t edit it now.

    Thread Starter Freelancealot

    (@freelancealot)

    Cheers.

    Thread Starter Freelancealot

    (@freelancealot)

    Hi,

    Thanks for posting. I did try the manual upload of 5.6.1 but it didn’t make any difference. Seems it may have been caused by another recently updated plugin that had an error in the version number, so when I updated it always went back to saying it needed updating. Or could have just been a coincidence.

    After the manual upload didn’t work, I contacted the hosting company and this time was told there was a script timing out (seen from the cpanel logs) so they updated some setting at their end they said was a little outdated and everything seem to be okay after that.

    I have stuck to v5.6.1 and seem to be running okay now.

    On the plus side, while I had all plugins deactivated for troubleshooting I did manage to track down a plugin conflict that was causing some head scratching. Cup half full ??

    I guess, my advice would be check the cPanel logs for scripts causing problems. I had only looked at the PHP error logs via FTP.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Hi,

    Thanks, I had already added the meta box snippet to my functions.php file. (from exactly the same link as your second ?? I didn’t mention that in my post sorry.

    Re your second link, I already have the partials/entry folder in the child theme.

    The problem was I used a hyphen to reference the custom post type instead of an underscore. So for those who might be having a slow moment like I was:

    
    if ( is_post_type_archive( 'my-event' )) {
    

    Should have been

    
    if ( is_post_type_archive( 'my_event' )) {
    

    Doh!

    Cheers,
    Tracy

    `

    Thread Starter Freelancealot

    (@freelancealot)

    Great, thank you for letting me know @needle. I’ll go update it.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Mystery solved. The brilliant and helpful Marcel Pol, author of Custom Taxonomy Order NE fixed the code for me.

    For anyone looking for an answer, here it is. First I installed Marcel’s plugin and then I did the following.

    Deleted this from the code in my post:

    $termchildren = get_term_children( $current_term->term_id, $taxonomyName );
        foreach ($termchildren as $child) {
        $term = get_term_by( 'id', $child, $taxonomyName );
            $wpq = array (

    And inserted this in it’s place:

    $termchildren = get_terms( array(
        'taxonomy' => $taxonomyName,
        'child_of' => $current_term->term_id,
    ) );
    
        foreach ($termchildren as $term) {
            $wpq = array (

    Works like a charm.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Hi bcworkz,

    Is there another way to achieve what I need in the WordPress loop to get the terms sorted by ‘name’.

    You can see a page in action here: https:// www. gotoalmanac. com/business-categories/more-useful-businesses (sorry, just made the site live and I don’t want a link). Here’s a link to the full taxonomy template: https://www.bizharbour.net/projects/test-goto-archive.txt.

    I know this has been done before, perhaps a ksort or something but don’t know how to get this in my code.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Hi,

    Thanks, I knew that would have to go in somewhere, just didn’t know where ??

    However, I’m getting:

    Fatal error: [] operator not supported for strings in … on the following line:

    $premium[] = $hit;

    Any ideas?

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    Hi Mikko,

    Thank you for the quick response, and I’m going to reveal my ignorance now.

    I’m assuming I need to enter something in the premium array() and the $rest array(), but I have no idea what. Sorry to bother you further on this but I need your help.

    This project has pushed the limits of my WordPress customisation knowledge, and first time using an advanced search plugin.

    Thanks for your patience.

    Cheers,
    Tracy

    Thread Starter Freelancealot

    (@freelancealot)

    No response on this one. Can anyone help?

    I will provide a login to the site of course (as posted in the original question).

    Thread Starter Freelancealot

    (@freelancealot)

    So, I’ve managed to get the Slick slider working with Simple Fields with the following code:

    <div class="slick-slider clearfix">
    <?php $aboutslideshow = simple_fields_get_post_group_values(get_the_id(),"Slides", true, 2);
            if ( isset($aboutslideshow) && count($aboutslideshow) > 0 ) {
    	foreach ( $aboutslideshow as $slide ) {
    	$slideimg = wp_get_attachment_image($slide['Image'], 'full');
    			?>
                <div class="slide">
                <?php echo $slideimg ;?>
               </div>
    	<?php }}?>
    </div>

    But I can’t for the life of me figure out how to get the image description or caption for the image. I’ve tried many variations, this is the last one:

    <div class="slick-slider clearfix">
    <?php $aboutslideshow = simple_fields_get_post_group_values(get_the_id(),"Slides", true, 2);
    
    	if ( isset($aboutslideshow) && count($aboutslideshow) > 0 ) {
    	foreach ( $aboutslideshow as $slide ) {
    	$slideimg = wp_get_attachment_image($slide['Image'], 'full');
    	$caption = get_the_excerpt();
    ?>
                <div class="slide">
                <?php echo $slideimg ;?>
      <p><?php echo $caption; ?>  </p>
               </div>
    	<?php }}?>
        </div>

    But this just gets the excerpt for the page, which is not what I want.

    Can someone please, please, please help. I’ve spent over two hours now trying to figure it out and I’m sure there’s an easy way of doing it that I’m not seeing.

    Thanks for your help in advance.

    Cheers,
    Tracy

Viewing 15 replies - 31 through 45 (of 67 total)