Hmm, figured out my own hacks to do the form validation and the widget resize. I also just hid the text area for the post content and now people are forced to use the visual editor.
Solving problems is fun 🙂
Plugin Author
inapan
(@inapan)
@krama757
I’m sorry I haven’t been able to dive into it yet. I have been very busy lately.
Would you mind sharing your solutions on the forum so more of us can benefit from it.
By the way, I agree with you: solving problems is fun (most of the time).
inapan
Np Inapan…I’m just thankful that you made such an awesome plugin.
I’ll give a brief idea of what I did:
Question: How would you resize the widget to only have a certain width?
Solution:
In quickpost-widget.php:
Place: “<div class=”quick_post”>” before the line “<form autocomplete=”off” method=”post” name=quickpostwidget action=”” >”
Then place your “</div>” after the “</form>”.
Now in your template files, you can add custom style sheets for div.quick_post to choose your width, height, etc.
Question: How would you validate the input in a custom field?
Solution: Look for for ($cfn = 1; $cfn <= $qpw_custom_fields_count; $cfn++) {
Here, if you know what your customfields are going to be then you can individually check your custom field values by using:
if($_POST['customfield_1'] == 'Some incorrect input'){
$error = 'yes';
?>
<script type="text/javascript">
document.getElementById(<?php echo '\'' . $customfield . '\''; ?>).style.border="solid 1px <?php echo $error_color; ?>";
</script> <?php
}
This should allow you to control and check the inputs of your various custom fields assuming you know what each custom field is supposed to be.
Question: How do you hide the textbox for post-content so that only the visual editor is used?
Solution:
In your widget settings, go to the style setting for post content and enter “visibility: hidden; position: absolute; top: 0; left: 0;” into the textbox.
That should effectively hide your post-content text box so people are forced to use the visual editor.
Happy Coding!
Question: How do you hide the textbox for post-content so that only the visual editor is used?
This question should be bolded in the previous post >.< I wish the forum had a front-end edit function 😛
@krama757 Thanks for that…very useful tip for hiding the textbox.