I have wordpress flash game website. Into the admin panel, where I add or edit post I have field named Swf URL: where I add SWF link and it links to the post where it shows flash game. I want to do same but not in the post, I want to use this function (adding game with the help of swf) to home page.
How it is now:
How I want to see:
functions code:
load_theme_textdomain( "freebabyhazelgames", TEMPLATEPATH."/languages" );
$locale = get_locale( );
$locale_file = TEMPLATEPATH."/languages/{$locale}.php";
if ( is_readable( $locale_file ) )
{
require_once( $locale_file );
}
$sp_boxes = array( "Game Details" => array( array( "thumb", "Game image URL:" ), array( "game", "Swf URL:" ) ) );
add_action( "admin_menu", "sp_add_custom_box" );
add_action( "save_post", "sp_save_postdata", 1, 2 );
if ( !function_exists( "get_custom_field" ) )
{
function get_custom_field( $field )
{
global $post;
$custom_field = get_post_meta( $post->ID, $field, true );
echo $custom_field;
}
}
post code:
<div id="playgame">
<script type="text/javascript">
<!--
swf("<?php $values = get_post_custom_values("game"); echo $values[0]; ?>", "701", "550");//-->
</script>
</div>
By the way I tried to change dirrectory or to copy single.php to index.php but both not worked.
If I understand you right, you want the game to appear on the main page without entering a post? In that case, I think you can try using a static frontpage instead of latest posts.
You can find it on Appearance -> Customize, and then choose the frontpage to be static. That way you can have your game on the static frontpage.