Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • owstopit

    (@owstopit)

    Having the same issue!

    Thread Starter owstopit

    (@owstopit)

    Alright, I found the problem. In order to get the gallery order working for the photos, I used a script I found online. Here is a gist with the fix:

    https://gist.github.com/vickybiswas/4211031

    When I was first using this fix, I was having trouble finding the right action to attach the function to so that the gallery order would be saved when I updated the post. Because of that I had all of these actions running a script that iterates through all of the photos:

    add_action(‘edit_post’, ‘pmc_gallery_menu_order_fix’);
    add_action(‘save_post’, ‘pmc_gallery_menu_order_fix’);
    add_action(‘publish_post’, ‘pmc_gallery_menu_order_fix’);
    add_action(‘edit_page_form’, ‘pmc_gallery_menu_order_fix’);
    add_action(‘pre_post_update’, ‘pmc_gallery_menu_order_fix’);

    So it was iterating through large amounts of data multiple times every time I tried to edit the post. I removed all but these two:

    add_action(‘edit_post’, ‘pmc_gallery_menu_order_fix’);
    add_action(‘publish_post’, ‘pmc_gallery_menu_order_fix’);

    And that seems to have fixed the issue!

    I’d love to find a better alternative to this fix, but so far that’s what I’ve found to work. I could redo the galleries altogether but that would probably require making complicated changes to the database in order to keep all of the image in order without having to remake the galleries and reorder them.

    Thank you for your help, I learned some valuable things in the process!

    Thread Starter owstopit

    (@owstopit)

    Unfortunately I’m getting the same error message. The error message doesn’t make sense to me since cpanel and the plugin on the wordpress dashboard seem to suggest that there is more than enough memory. I’m starting to wonder if it’s related to execution time. Any other ideas?

    Thread Starter owstopit

    (@owstopit)

    Hey James!

    I am not using any plugins to build or control the galleries, I’m using the built-in galleries. I wrote a custom theme and basically pull the images from the post gallery as well as maintain the order of the images based on the gallery order. I did notice that I hadn’t in fact removed the WP_MEMORY_LIMIT definition from wp-config.php and just now did so. So far, the problem persists, not sure if these changes take some amount of time to go into effect. Here is the information from the plugin you recommended:

    Memory: 19.93 of 512 MB (4%) | WP LIMIT: 40 MB | PHP 5.4.43 @64BitOS

    Thanks for your help, hopefully that sheds some light on the situation!

    Thread Starter owstopit

    (@owstopit)

    Thanks James,

    So I chatted with GoDaddy (that’s the hosting company for this particular site) and explained the issue. The person I talked to uploaded a php.ini file to the website root with the following lines:

    post_max_size = 128M
    upload_max_filesize = 1G
    memory_limit = 512M
    max_execution_time = 300
    max_input_time = 300
    max_input_vars = 2000

    So far, it hasn’t helped anything and the problem still persists. To explain a bit more about what is actually happening when I get the error: the website features photo galleries in different categories for each photographer. Each gallery is represented by a post which contains a wordpress photo gallery. The images and the order of images is pulled from the photo gallery.

    Any time I try to make a change to one of the galleries or even if I just open a post, do nothing to it and press “update,” I get the same error. I did notice that the browser sits there processing the post update for a pretty long time before I get the error. I’m wondering if this might shed light on why it’s not working despite the increased memory limit.

    The galleries tend to have quite a lot of photos. I’m wondering if maybe moving to a different format might eliminate the problem. I’ve thought of using something like simple fields to upload the photos, or maybe finding a plugin that makes it easy to deal with large numbers of photos. Given the php.ini file that was uploaded, can you shed any light on why the error persists? Thanks!

    Thread Starter owstopit

    (@owstopit)

    Hey kdbates!

    Haha, sorry let me explain what’s goin on here!

    The method I was using I learned from this page:

    https://codex.www.ads-software.com/Function_Reference/get_post

    This is just one method to get a specific post’s content. I set the post’s id to a variable using $contact_id = 73 (73 being the id of the contact page) and then pass the id to the get_post() function. You can’t pass the value 73 by itself, it must be within a variable which is why I set it to the $contact_id variable. Next I put the results of the get_post() into a variable called $contact_post_id. Finally I access the property “post_title” and “post_id” from the post object that is returned to the $contact_post_id variable. Now I’ve got a variable called $title containing the post’s title and $content containing the content.

    Not sure if that’s what you wanted to know, but thought I’d include it just in case. Now the important part:

    When you use the_content() function to show a post or page’s content, the content receives formatting, aka the paragraph tags and such that I was hoping for. Since I didn’t end up using the_content() function, I was losing this formatting. Once I realized this, I opted for a different method of getting the content for the post. The method I used instead was the query_posts() function. Here’s all of the nitty gritty about this function:

    https://codex.www.ads-software.com/Function_Reference/query_posts

    On a specific wordpress page (such as an “about” page, for example) there is this piece of code:

    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

    and further down in the page.php code you’ll see

    <?php the_content(); ?>

    This will take the content from whatever page you’re surfing. So if you’re on the About page, the content will be pulled from whatever is typed in the WYSIWYG editor on the about page editor. Using query_posts(), you’re telling wordpress to look at a different page than the one your surfing. I ended up using this code:

    <?php
    
    	//The Query
    	query_posts('page_id=73&posts_per_page=-1');
    
    	//The Loop
    	if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    	<li id="contact_div" class="invis post section">
    	        <div id="contact_content" class="section_content">
    		        <h4><?php the_title(); ?></h4>
    		        <?php the_content(); ?>
    	        </div>
    	</li>
    
    	<?php endwhile; ?>
    
    	<?php endif; ?>
    
            <?php wp_reset_query(); ?>

    So now, because of the query_posts() function, when I call “the_content();” I am actually pulling the content from the page with the id of 73 instead of the page I’m currently on. So I am able to pull in content from another page and because I am using the_content(); function, the formatting (each line wrapped in paragraph tags) remains and looks the way I typed it in in the WYSIWYG editor.

    Ok I hope this explanation wasn’t totally over-detailed but I thought I’d try to be extra thorough ??

    Hope this helps ??

    Thread Starter owstopit

    (@owstopit)

    Alright, well I’ve figured out the problem and feel pretty stupid ??

    Turns out I was focusing on one section of the content. Particularly, a section where I was drawing the content using this method:

    <?php
    $contact_id = 73;
    $contact_post_id = get_post($contact_id);
    $title = $contact_post_id->post_title;
    $content = $contact_post_id->post_content;
    ?>
    
    <li id="contact_div" class="invis post">
    <div id="contact_content">
    <h4><?php echo $title; ?></h4>
    <?php echo $content; ?>
    </div>
    </li>

    Sorry to bother you guys with a problem that stemmed from my lack of troubleshooting! Not sure what the protocol in this situation is, but should I just delete this post, since the problem is actually much different than the title suggests?

    thanks

    Thread Starter owstopit

    (@owstopit)

    Ok, good to know. Thanks a lot for your help! If I figure this out, I’ll post it here. I think it’s either a problem my theme’s index.php file or a jQuery complication. Thanks again!

    Thread Starter owstopit

    (@owstopit)

    Hmm, still checking but haven’t found anything yet…

    I know this is an old post and the 2010 theme doesn’t have this problem, but any chance this is similar to this problem:

    https://www.ads-software.com/support/topic/tiny-mce-strips-paragraph-tags?replies=7

    Thread Starter owstopit

    (@owstopit)

    Alright well I feel like an idiot!

    Changing to the 2010 theme has restored the individual paragraphs. I will start the debugging process. Any idea what can cause a bug like this?

    Thanks

    Thread Starter owstopit

    (@owstopit)

    Thanks Esmi,

    I will try this and report back

    Thanks for figuring this out! I’ve noticed that the page still scrolls to the top, but then scrolls back down. If you also take out the line:

    window.scrollTo(0,t.Top);

    It will no longer do this, and will simply stay in one place. Thank you SO MUCH for figuring this out!

Viewing 12 replies - 1 through 12 (of 12 total)